@bridge-ds/core 0.7.0 → 0.8.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/{component-spec-1z2ih4E3.js → component-spec-SKuywZqr.js} +36 -31
- package/dist/component-spec-SKuywZqr.js.map +1 -0
- package/dist/docs-proposal.d.ts +73 -1
- package/dist/explorations-github.d.ts +2 -0
- package/dist/index.js +111 -38
- package/dist/index.js.map +1 -1
- package/dist/node/index.js +3 -1
- package/dist/node/index.js.map +1 -1
- package/dist/products.d.ts +9 -0
- package/package.json +1 -1
- package/dist/component-spec-1z2ih4E3.js.map +0 -1
package/dist/docs-proposal.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentDocsJson } from './docs-draft';
|
|
2
|
-
import type { GitHubClient } from './github-client';
|
|
2
|
+
import type { GitHubClient, PullRequestSummary } from './github-client';
|
|
3
3
|
import { type RiskResult } from './risk';
|
|
4
4
|
/** One component's docs.json, before (null: a new file) and after, at its repo path. */
|
|
5
5
|
export interface DocsFileEdit {
|
|
@@ -42,6 +42,68 @@ export interface DocsProposal {
|
|
|
42
42
|
bump: 'patch';
|
|
43
43
|
labels: string[];
|
|
44
44
|
}
|
|
45
|
+
/** The branch slug of a component's docs: "visually-hidden" for VisuallyHidden or visually-hidden, at most 40 characters. */
|
|
46
|
+
export declare const docsSlug: (nameOrSlug: string) => string;
|
|
47
|
+
/** Section names (as the editor shows them) by who wrote their text in this send. */
|
|
48
|
+
export interface DocsAuthorship {
|
|
49
|
+
/** Drafted by Claude, kept as Claude wrote it after review. */
|
|
50
|
+
claude: string[];
|
|
51
|
+
/** Drafted by Claude, then edited by the person. */
|
|
52
|
+
edited: string[];
|
|
53
|
+
/** Written by the person, no Claude draft involved. */
|
|
54
|
+
written: string[];
|
|
55
|
+
/** Drafted by Claude, not reviewed yet (they go out marked for review). */
|
|
56
|
+
pending: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The author line of a docs proposal: "by a person, no AI" only when no Claude draft is in the text; "drafted by
|
|
60
|
+
* Claude AI, reviewed and sent by @ana" when the person kept Claude's text as is; "drafted by Claude AI, edited by
|
|
61
|
+
* @ana" with the edited sections when they changed parts of it.
|
|
62
|
+
*/
|
|
63
|
+
export declare function docsAuthorLine(a: DocsAuthorship, who: string | null | undefined, where?: string): string;
|
|
64
|
+
/** Without an author line from the editor: the docs' own record ("draftedBy": "claude") decides, never "no AI" over it. */
|
|
65
|
+
export declare function defaultDocsFooter(edits: Pick<DocsFileEdit, 'after'>[], origin: DocsOrigin): string;
|
|
66
|
+
/** The body with its author line (the text after the last "---" line) replaced, or added when it has none. */
|
|
67
|
+
export declare function withAuthorLine(body: string, line: string): string;
|
|
68
|
+
/** The open docs proposal of a component: the one a new send continues instead of opening a second one. */
|
|
69
|
+
export interface OpenDocsProposal {
|
|
70
|
+
number: number;
|
|
71
|
+
url: string;
|
|
72
|
+
branch: string;
|
|
73
|
+
author: string;
|
|
74
|
+
title: string;
|
|
75
|
+
updatedAt: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* True when `branch` is a docs proposal branch of this component: docs/<slug>-<yyyymmdd>-<id>, with an optional Jira
|
|
79
|
+
* key before the slug (docs/DS-42-button-...). "button" does not match docs/button-group-... branches. Older MCP
|
|
80
|
+
* branches used the lowercased name (docs/visuallyhidden-...): they match too.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isDocsProposalBranch(branch: string, component: {
|
|
83
|
+
name: string;
|
|
84
|
+
slug?: string | undefined;
|
|
85
|
+
}): boolean;
|
|
86
|
+
type PullLike = Pick<PullRequestSummary, 'number' | 'state' | 'headRef' | 'author' | 'title' | 'url' | 'updatedAt'> & {
|
|
87
|
+
baseRef?: string | undefined;
|
|
88
|
+
};
|
|
89
|
+
/** The most recently updated open docs proposal of the component (into `base` when given), or null. */
|
|
90
|
+
export declare function findOpenDocsProposal(pulls: PullLike[], component: {
|
|
91
|
+
name: string;
|
|
92
|
+
slug?: string | undefined;
|
|
93
|
+
}, base?: string): OpenDocsProposal | null;
|
|
94
|
+
/** Reads the open pull requests and returns the component's open docs proposal, or null. */
|
|
95
|
+
export declare function findOpenDocsProposalOnGitHub(gh: GitHubClient, component: {
|
|
96
|
+
name: string;
|
|
97
|
+
slug?: string | undefined;
|
|
98
|
+
}, base?: string): Promise<OpenDocsProposal | null>;
|
|
99
|
+
/**
|
|
100
|
+
* Adds a send to the open proposal: one commit with the docs.json on its branch (nothing when the text is the same),
|
|
101
|
+
* and the author line of its description brought up to date. Returns the commit sha, or '' when nothing changed.
|
|
102
|
+
*/
|
|
103
|
+
export declare function continueDocsProposalOnGitHub(gh: GitHubClient, open: Pick<OpenDocsProposal, 'number' | 'branch'>, edit: Pick<DocsFileEdit, 'path' | 'component' | 'after'>, opts?: {
|
|
104
|
+
authorLine?: string | undefined;
|
|
105
|
+
message?: string | undefined;
|
|
106
|
+
}): Promise<string>;
|
|
45
107
|
/** One pull request for the docs edits of a draft: branch, title, body, files with a patch changeset, the tier. */
|
|
46
108
|
export declare function docsProposal(edits: DocsFileEdit[], opts: {
|
|
47
109
|
title?: string | undefined;
|
|
@@ -50,10 +112,13 @@ export declare function docsProposal(edits: DocsFileEdit[], opts: {
|
|
|
50
112
|
packageName?: string | undefined;
|
|
51
113
|
changesetDir?: string | undefined;
|
|
52
114
|
origin?: DocsOrigin | undefined;
|
|
115
|
+
authorLine?: string | undefined;
|
|
53
116
|
}): DocsProposal;
|
|
54
117
|
/**
|
|
55
118
|
* Opens one pull request with the docs edits from the default branch, the Jira key first in the title and the branch
|
|
56
119
|
* name (Jira's GitHub integration links them). Returns its number, link and branch. Labels are best effort.
|
|
120
|
+
* One open proposal per component: when the component already has one, the edit goes there as a new commit
|
|
121
|
+
* (`continued`; `unchanged` when it already says this) instead of a second pull request.
|
|
57
122
|
*/
|
|
58
123
|
export declare function proposeDocsOnGitHub(gh: GitHubClient, edits: DocsFileEdit[], opts: {
|
|
59
124
|
base: string;
|
|
@@ -64,11 +129,17 @@ export declare function proposeDocsOnGitHub(gh: GitHubClient, edits: DocsFileEdi
|
|
|
64
129
|
origin?: DocsOrigin | undefined;
|
|
65
130
|
extraLabels?: string[] | undefined;
|
|
66
131
|
commitNote?: string | undefined;
|
|
132
|
+
/** Who wrote the text (docsAuthorLine). Without it, the origin's footer, never "no AI" over a Claude draft. */
|
|
133
|
+
authorLine?: string | undefined;
|
|
134
|
+
/** Default true: continue the component's open proposal. False always opens a new one. */
|
|
135
|
+
continueOpen?: boolean | undefined;
|
|
67
136
|
}): Promise<{
|
|
68
137
|
number: number;
|
|
69
138
|
url: string;
|
|
70
139
|
branch: string;
|
|
71
140
|
title: string;
|
|
141
|
+
continued: boolean;
|
|
142
|
+
unchanged: boolean;
|
|
72
143
|
}>;
|
|
73
144
|
/**
|
|
74
145
|
* Rewrites one file on an open branch in one commit (`next` gets the current text). Returns the commit sha, or ''
|
|
@@ -80,3 +151,4 @@ export declare function commitFileOnGitHub(gh: GitHubClient, input: {
|
|
|
80
151
|
message: string;
|
|
81
152
|
next: (text: string) => string;
|
|
82
153
|
}): Promise<string>;
|
|
154
|
+
export {};
|
|
@@ -14,6 +14,8 @@ export interface ExplorationSettings {
|
|
|
14
14
|
number: number;
|
|
15
15
|
title: string;
|
|
16
16
|
}[] | undefined;
|
|
17
|
+
/** More labels for the draft pull request, such as the product ones (productMarks). */
|
|
18
|
+
labels?: string[] | undefined;
|
|
17
19
|
}
|
|
18
20
|
export interface ExplorationSummary {
|
|
19
21
|
number: number;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { u as modeDisplayName, w as modesOf$1, x as isMultiMode, T as TIER_NAMES, y as TIER_AXIS, z as findReferenceProblems, A as evaluatePairs, B as contrastScope, D as contextLabel, S as SINGLE_MODE, E as pathId, F as flattenTokens, G as serializeTokenFile, H as removeToken, I as upsertToken, J as threeWayDiff, K as emptyTokenFile, L as parseTokenFile, M as EXT_ID, N as EXT_SCOPES, n as resolve, O as moveToken, P as effectiveScopes, Q as sameScopes, R as defaultScopes, U as readTokenAt, V as modeFile, W as defaultFile, X as DEFAULT_PROTECTED_BRANCHES, a as assertSafeBranch, Y as ProtectedBranchError, C as CONFIG_FILE, l as loadConfig, Z as ConfigError, _ as DEFAULT_TOKEN_PATHS, c as collectHistory, p as packageDirCandidates, b as parseChangelog, r as releasesFromTags, m as mergeReleases, d as buildReport, $ as applyTokenEdits, a0 as buildHistoryEntry, a1 as resolveBranchPreviews, a2 as tokensPath, a3 as coerceValue, a4 as toConfigJson, a5 as parseContrastChecks, a6 as checkLayeredPair, a7 as classifyRisk, a8 as formatChangeset, a9 as RISK_LABELS, aa as parseJson, ab as serializeJson, ac as plainEqual, ad as toPlain, ae as getEntry, af as fromPlain, ag as previewLinks, ah as slugify, ai as readPreviewComment, aj as findPreviewComment, ak as previewsSettled, f as variantKeyOf, al as canShip, am as whoCanShipSentence, an as unreadableShipTeams, g as layoutOptions, j as buildTokenSet } from "./component-spec-
|
|
2
|
-
import { ao, ap, aq, q, o, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, k, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, h, bD, i, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, e, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg,
|
|
1
|
+
import { u as modeDisplayName, w as modesOf$1, x as isMultiMode, T as TIER_NAMES, y as TIER_AXIS, z as findReferenceProblems, A as evaluatePairs, B as contrastScope, D as contextLabel, S as SINGLE_MODE, E as pathId, F as flattenTokens, G as serializeTokenFile, H as removeToken, I as upsertToken, J as threeWayDiff, K as emptyTokenFile, L as parseTokenFile, M as EXT_ID, N as EXT_SCOPES, n as resolve, O as moveToken, P as effectiveScopes, Q as sameScopes, R as defaultScopes, U as readTokenAt, V as modeFile, W as defaultFile, X as DEFAULT_PROTECTED_BRANCHES, a as assertSafeBranch, Y as ProtectedBranchError, C as CONFIG_FILE, l as loadConfig, Z as ConfigError, _ as DEFAULT_TOKEN_PATHS, c as collectHistory, p as packageDirCandidates, b as parseChangelog, r as releasesFromTags, m as mergeReleases, d as buildReport, $ as applyTokenEdits, a0 as buildHistoryEntry, a1 as resolveBranchPreviews, a2 as tokensPath, a3 as coerceValue, a4 as toConfigJson, a5 as parseContrastChecks, a6 as checkLayeredPair, a7 as classifyRisk, a8 as formatChangeset, a9 as RISK_LABELS, aa as parseJson, ab as serializeJson, ac as plainEqual, ad as toPlain, ae as getEntry, af as fromPlain, ag as previewLinks, ah as slugify, ai as readPreviewComment, aj as findPreviewComment, ak as previewsSettled, f as variantKeyOf, al as canShip, am as whoCanShipSentence, an as unreadableShipTeams, g as layoutOptions, j as buildTokenSet } from "./component-spec-SKuywZqr.js";
|
|
2
|
+
import { ao, ap, aq, q, o, ar, as, at, au, av, aw, ax, ay, az, aA, aB, aC, aD, aE, aF, aG, aH, aI, aJ, aK, aL, aM, aN, aO, aP, aQ, aR, aS, aT, aU, aV, aW, aX, aY, aZ, a_, a$, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, ba, bb, bc, bd, be, bf, bg, bh, k, bi, bj, bk, bl, bm, bn, bo, bp, bq, br, bs, bt, bu, bv, bw, bx, by, bz, bA, bB, bC, h, bD, i, bE, bF, bG, bH, bI, bJ, bK, bL, bM, bN, bO, bP, bQ, bR, bS, bT, bU, bV, bW, bX, bY, bZ, b_, b$, e, c0, c1, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, s, ci, cj, ck, cl, cm, cn, co, cp, cq, cr, cs, t, ct, cu, cv, v, cw, cx, cy, cz } from "./component-spec-SKuywZqr.js";
|
|
3
3
|
import { a as collectRefs, i as isAlias, b as aliasTarget, v as valuesEqual, p as parseColor, e as rgbaToHex, f as formatValue, s as selectTokenFiles, L as LayeredTokenSet, j as validateLayered } from "./layered-BnbmToGs.js";
|
|
4
4
|
import { D, d, k as k2, l, c, m, n, g, h as h2, o as o2, q as q2, r, t as t2, u } from "./layered-BnbmToGs.js";
|
|
5
5
|
const issueKey = (i2) => `${i2.code}|${i2.path ?? ""}|${i2.mode ?? ""}|${i2.code === "file-problem" ? i2.message : ""}`;
|
|
@@ -3788,7 +3788,7 @@ Exploration: never merged as is. Promote it to review or close it.`,
|
|
|
3788
3788
|
const ctx = { owner: gh.owner, repo: gh.name, packages: s2.packages, apps: s2.apps, ...s2.requests?.length ? { requests: s2.requests } : {} };
|
|
3789
3789
|
const title = full.jira ? `${full.jira.trim().toUpperCase()} ${explorationPrTitle(full)}` : explorationPrTitle(full);
|
|
3790
3790
|
const pr = await x.createPullRequest({ title, head: branch, base: s2.base, body: explorationPrBody(full, ctx), draft: true });
|
|
3791
|
-
await x.addLabels(pr.number, [EXPLORATION_LABEL]);
|
|
3791
|
+
await x.addLabels(pr.number, [EXPLORATION_LABEL, ...s2.labels ?? []]);
|
|
3792
3792
|
await x.updatePullRequest(pr.number, { body: explorationPrBody(full, { ...ctx, pr: pr.number }) }).catch(() => void 0);
|
|
3793
3793
|
return {
|
|
3794
3794
|
branch,
|
|
@@ -4617,7 +4617,7 @@ function branchWithJiraKey(branch, key) {
|
|
|
4617
4617
|
}
|
|
4618
4618
|
const DOCS_EDITOR_ORIGIN = {
|
|
4619
4619
|
where: "in the Bridge docs editor",
|
|
4620
|
-
footer:
|
|
4620
|
+
footer: "Written by a person in the Bridge docs editor. No AI involved in this text.",
|
|
4621
4621
|
label: "source: bridge-web"
|
|
4622
4622
|
};
|
|
4623
4623
|
const DOCS_MCP_ORIGIN = {
|
|
@@ -4654,13 +4654,69 @@ function cleanDocs(d2) {
|
|
|
4654
4654
|
const docsText = (d2) => formatDocsJson(cleanDocs(d2));
|
|
4655
4655
|
const docsFileText = (d2, original) => patchDocsJson(original, cleanDocs(d2));
|
|
4656
4656
|
const slugDate = (d2) => d2.toISOString().slice(0, 10).replace(/-/g, "");
|
|
4657
|
+
const docsSlug = (nameOrSlug) => nameOrSlug.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().replace(/[^a-z0-9-]+/g, "-").slice(0, 40);
|
|
4658
|
+
const listOf = (xs) => xs.length < 2 ? xs[0] ?? "" : `${xs.slice(0, -1).join(", ")} and ${xs[xs.length - 1]}`;
|
|
4659
|
+
function docsAuthorLine(a, who, where = "the Bridge docs editor") {
|
|
4660
|
+
const w = who?.trim() ? `@${who.trim().replace(/^@/, "")}` : "a person";
|
|
4661
|
+
if (!a.claude.length && !a.edited.length && !a.pending.length) return `Written by ${w} in ${where}. No AI involved in this text.`;
|
|
4662
|
+
const head = a.edited.length ? `Drafted by Claude AI, edited by ${w} in ${where}.` : a.claude.length ? `Drafted by Claude AI, reviewed and sent by ${w} in ${where}.` : `Drafted by Claude AI, sent by ${w} in ${where} before review.`;
|
|
4663
|
+
const mixed = [a.edited, a.written, a.pending].some((x) => x.length);
|
|
4664
|
+
return [
|
|
4665
|
+
head,
|
|
4666
|
+
a.edited.length ? `Edited by ${w}: ${listOf(a.edited)}.` : "",
|
|
4667
|
+
a.claude.length && mixed ? `As Claude drafted them: ${listOf(a.claude)}.` : "",
|
|
4668
|
+
a.written.length ? `Written by ${w}: ${listOf(a.written)}.` : "",
|
|
4669
|
+
a.pending.length && (a.claude.length || a.edited.length || a.written.length) ? `Not reviewed yet: ${listOf(a.pending)}.` : ""
|
|
4670
|
+
].filter(Boolean).join(" ");
|
|
4671
|
+
}
|
|
4672
|
+
function defaultDocsFooter(edits, origin) {
|
|
4673
|
+
if (origin.label !== DOCS_EDITOR_ORIGIN.label) return origin.footer;
|
|
4674
|
+
const claude = edits.some((e2) => {
|
|
4675
|
+
try {
|
|
4676
|
+
return JSON.parse(e2.after).draftedBy === "claude";
|
|
4677
|
+
} catch {
|
|
4678
|
+
return false;
|
|
4679
|
+
}
|
|
4680
|
+
});
|
|
4681
|
+
return claude ? `Drafted by Claude AI (the docs say "draftedBy": "claude"), sent by a person ${origin.where}.` : origin.footer;
|
|
4682
|
+
}
|
|
4683
|
+
function withAuthorLine(body, line) {
|
|
4684
|
+
const i2 = body.lastIndexOf("\n---\n");
|
|
4685
|
+
return i2 < 0 ? `${body.trimEnd()}
|
|
4686
|
+
|
|
4687
|
+
---
|
|
4688
|
+
${line}` : `${body.slice(0, i2 + 5)}${line}`;
|
|
4689
|
+
}
|
|
4690
|
+
const escapeRe = (s2) => s2.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4691
|
+
function isDocsProposalBranch(branch, component) {
|
|
4692
|
+
const slugs = /* @__PURE__ */ new Set([docsSlug(component.slug ?? component.name), docsSlug(component.name), docsSlug(component.name.toLowerCase())]);
|
|
4693
|
+
return [...slugs].some((s2) => new RegExp(`^docs/(?:[A-Z][A-Z0-9]*-\\d+-)?${escapeRe(s2)}-\\d{8}-[a-z0-9]+$`).test(branch));
|
|
4694
|
+
}
|
|
4695
|
+
function findOpenDocsProposal(pulls, component, base) {
|
|
4696
|
+
const hit = pulls.filter((p) => p.state === "open" && isDocsProposalBranch(p.headRef, component) && (!base || !p.baseRef || p.baseRef === base)).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))[0];
|
|
4697
|
+
return hit ? { number: hit.number, url: hit.url, branch: hit.headRef, author: hit.author, title: hit.title, updatedAt: hit.updatedAt } : null;
|
|
4698
|
+
}
|
|
4699
|
+
async function findOpenDocsProposalOnGitHub(gh, component, base) {
|
|
4700
|
+
return findOpenDocsProposal(await gh.listPullRequests("open"), component, base);
|
|
4701
|
+
}
|
|
4702
|
+
async function continueDocsProposalOnGitHub(gh, open, edit, opts = {}) {
|
|
4703
|
+
const message = opts.message ?? `docs(${docsSlug(edit.component)}): edit usage guidance in the Bridge docs editor`;
|
|
4704
|
+
const cur = await gh.getFile(edit.path, open.branch);
|
|
4705
|
+
if (cur?.text === edit.after) return "";
|
|
4706
|
+
const sha = await gh.putFile({ path: edit.path, content: edit.after, branch: open.branch, message, sha: cur?.sha });
|
|
4707
|
+
if (opts.authorLine) {
|
|
4708
|
+
const line = opts.authorLine;
|
|
4709
|
+
await gh.getPullRequest(open.number).then((pr) => gh.updatePullRequest(open.number, { body: withAuthorLine(pr.body, line) })).catch(() => void 0);
|
|
4710
|
+
}
|
|
4711
|
+
return sha;
|
|
4712
|
+
}
|
|
4657
4713
|
function docsProposal(edits, opts) {
|
|
4658
4714
|
const origin = opts.origin ?? DOCS_EDITOR_ORIGIN;
|
|
4659
4715
|
if (!edits.length) throw new Error("No docs edits in the draft.");
|
|
4660
4716
|
const names2 = edits.map((e2) => e2.component);
|
|
4661
4717
|
const list = names2.length === 1 ? names2[0] : `${names2.slice(0, -1).join(", ")} and ${names2[names2.length - 1]}`;
|
|
4662
4718
|
const title = opts.title?.trim() || `docs(${names2.length === 1 ? edits[0].slug : "components"}): usage guidance for ${list}`;
|
|
4663
|
-
const slug =
|
|
4719
|
+
const slug = docsSlug(names2.length === 1 ? edits[0].slug : `${edits[0].slug}-and-${names2.length - 1}-more`);
|
|
4664
4720
|
const branch = `docs/${slug}-${slugDate(opts.date)}-${opts.date.getTime().toString(36).slice(-4)}`;
|
|
4665
4721
|
const csPath = `${opts.changesetDir ?? ".changeset"}/docs-${slug}-${opts.date.getTime().toString(36)}.md`;
|
|
4666
4722
|
const pkg = opts.packageName ?? "@bridge-ds/react";
|
|
@@ -4697,12 +4753,20 @@ Usage guidance for ${list}.
|
|
|
4697
4753
|
${opts.notes.trim()}
|
|
4698
4754
|
` : "",
|
|
4699
4755
|
"---",
|
|
4700
|
-
origin
|
|
4756
|
+
opts.authorLine?.trim() || defaultDocsFooter(edits, origin)
|
|
4701
4757
|
].filter((x, i2, a) => !(x === "" && a[i2 - 1] === "")).join("\n");
|
|
4702
4758
|
return { branch, title, body, files, risk, bump: "patch", labels: ["docs", origin.label, `tier-${risk.tier}`] };
|
|
4703
4759
|
}
|
|
4704
4760
|
async function proposeDocsOnGitHub(gh, edits, opts) {
|
|
4705
|
-
|
|
4761
|
+
if (opts.continueOpen !== false && edits.length === 1) {
|
|
4762
|
+
const e2 = edits[0];
|
|
4763
|
+
const open = await findOpenDocsProposalOnGitHub(gh, { name: e2.component, slug: e2.slug }, opts.base).catch(() => null);
|
|
4764
|
+
if (open) {
|
|
4765
|
+
const sha = await continueDocsProposalOnGitHub(gh, open, e2, { authorLine: opts.authorLine?.trim() || defaultDocsFooter(edits, opts.origin ?? DOCS_EDITOR_ORIGIN) });
|
|
4766
|
+
return { number: open.number, url: open.url, branch: open.branch, title: open.title, continued: true, unchanged: !sha };
|
|
4767
|
+
}
|
|
4768
|
+
}
|
|
4769
|
+
const p = docsProposal(edits, { title: opts.title, notes: opts.notes, date: opts.date ?? /* @__PURE__ */ new Date(), origin: opts.origin, authorLine: opts.authorLine });
|
|
4706
4770
|
const prTitle = titleWithJiraKey(p.title, opts.jira ?? null);
|
|
4707
4771
|
const branch = branchWithJiraKey(p.branch, opts.jira ?? null);
|
|
4708
4772
|
const mainSha = await gh.getBranchSha(opts.base);
|
|
@@ -4714,7 +4778,7 @@ ${opts.commitNote ?? "Proposed with the Bridge docs editor."}`, tree, [mainSha])
|
|
|
4714
4778
|
await gh.createBranch(branch, commit);
|
|
4715
4779
|
const pr = await gh.createPullRequest({ title: prTitle, head: branch, base: opts.base, body: p.body, draft: false });
|
|
4716
4780
|
await gh.addLabels(pr.number, [...p.labels, ...opts.extraLabels ?? []]).catch(() => false);
|
|
4717
|
-
return { number: pr.number, url: pr.url, branch, title: prTitle };
|
|
4781
|
+
return { number: pr.number, url: pr.url, branch, title: prTitle, continued: false, unchanged: false };
|
|
4718
4782
|
}
|
|
4719
4783
|
async function commitFileOnGitHub(gh, input) {
|
|
4720
4784
|
const cur = await gh.getFile(input.path, input.branch);
|
|
@@ -5052,6 +5116,7 @@ export {
|
|
|
5052
5116
|
conflictRoute,
|
|
5053
5117
|
ba as contextFor,
|
|
5054
5118
|
contextLabel,
|
|
5119
|
+
continueDocsProposalOnGitHub,
|
|
5055
5120
|
bb as contrastDelta,
|
|
5056
5121
|
bc as contrastDeltaTable,
|
|
5057
5122
|
bd as contrastLevel,
|
|
@@ -5072,6 +5137,7 @@ export {
|
|
|
5072
5137
|
decodePicks,
|
|
5073
5138
|
defaultChoiceFor,
|
|
5074
5139
|
k as defaultContext,
|
|
5140
|
+
defaultDocsFooter,
|
|
5075
5141
|
defaultFile,
|
|
5076
5142
|
bi as defaultProduct,
|
|
5077
5143
|
defaultScopes,
|
|
@@ -5082,6 +5148,7 @@ export {
|
|
|
5082
5148
|
bl as detectLayout,
|
|
5083
5149
|
bm as diffLayered,
|
|
5084
5150
|
dismissStaleFrom,
|
|
5151
|
+
docsAuthorLine,
|
|
5085
5152
|
docsFileText,
|
|
5086
5153
|
docsPrompt,
|
|
5087
5154
|
docsProposal,
|
|
@@ -5089,6 +5156,7 @@ export {
|
|
|
5089
5156
|
docsSectionsAnswer,
|
|
5090
5157
|
docsSectionsResult,
|
|
5091
5158
|
docsSelectionPrompt,
|
|
5159
|
+
docsSlug,
|
|
5092
5160
|
docsTaskKeys,
|
|
5093
5161
|
docsTaskPrompt,
|
|
5094
5162
|
docsText,
|
|
@@ -5132,6 +5200,8 @@ export {
|
|
|
5132
5200
|
bt as fileModes,
|
|
5133
5201
|
bu as filterHistory,
|
|
5134
5202
|
findExplorationOnGitHub,
|
|
5203
|
+
findOpenDocsProposal,
|
|
5204
|
+
findOpenDocsProposalOnGitHub,
|
|
5135
5205
|
findPreviewComment,
|
|
5136
5206
|
bv as findProduct,
|
|
5137
5207
|
findReferenceProblems,
|
|
@@ -5170,6 +5240,7 @@ export {
|
|
|
5170
5240
|
isActiveExploration,
|
|
5171
5241
|
isAlias,
|
|
5172
5242
|
isAutomationPull,
|
|
5243
|
+
isDocsProposalBranch,
|
|
5173
5244
|
isDocsSelectionMode,
|
|
5174
5245
|
isDraftSessionId,
|
|
5175
5246
|
isExplorationBranch,
|
|
@@ -5284,18 +5355,19 @@ export {
|
|
|
5284
5355
|
previewsSettled,
|
|
5285
5356
|
c3 as productForPlace,
|
|
5286
5357
|
c4 as productLabel,
|
|
5287
|
-
c5 as
|
|
5358
|
+
c5 as productMarks,
|
|
5359
|
+
c6 as productOfBranch,
|
|
5288
5360
|
productPreview,
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5361
|
+
c7 as productProblems,
|
|
5362
|
+
c8 as productsOf,
|
|
5363
|
+
c9 as projectOfLabel,
|
|
5292
5364
|
promoteExplorationOnGitHub,
|
|
5293
5365
|
promotionPlan,
|
|
5294
5366
|
proposeDocsOnGitHub,
|
|
5295
5367
|
propsTable,
|
|
5296
5368
|
protectLibrary,
|
|
5297
5369
|
protectRefusal,
|
|
5298
|
-
|
|
5370
|
+
ca as protectedBranchesOf,
|
|
5299
5371
|
protectionRuleset,
|
|
5300
5372
|
protectionRulesetName,
|
|
5301
5373
|
protectionSentence,
|
|
@@ -5314,7 +5386,7 @@ export {
|
|
|
5314
5386
|
releasesFromTags,
|
|
5315
5387
|
removeToken,
|
|
5316
5388
|
removedSide,
|
|
5317
|
-
|
|
5389
|
+
cb as renderedColor,
|
|
5318
5390
|
reopenEligibility,
|
|
5319
5391
|
reopenOnGitHub,
|
|
5320
5392
|
requestBrief,
|
|
@@ -5334,14 +5406,14 @@ export {
|
|
|
5334
5406
|
reviewersToAsk,
|
|
5335
5407
|
r as rgbaToDtcg,
|
|
5336
5408
|
rgbaToHex,
|
|
5337
|
-
|
|
5409
|
+
cc as rightsProblems,
|
|
5338
5410
|
round3,
|
|
5339
5411
|
rulesSettingsUrl,
|
|
5340
5412
|
rulesetTargetsDefault,
|
|
5341
|
-
|
|
5342
|
-
|
|
5413
|
+
cd as runLayeredContrast,
|
|
5414
|
+
ce as sameProducts,
|
|
5343
5415
|
sameScopes,
|
|
5344
|
-
|
|
5416
|
+
cf as sameToken,
|
|
5345
5417
|
sanitizeDocsReplacement,
|
|
5346
5418
|
sanitizeDocsResult,
|
|
5347
5419
|
sanitizeDocsSections,
|
|
@@ -5358,12 +5430,12 @@ export {
|
|
|
5358
5430
|
shareDescription,
|
|
5359
5431
|
shareMessage,
|
|
5360
5432
|
shareState,
|
|
5361
|
-
|
|
5433
|
+
cg as shipPolicy,
|
|
5362
5434
|
shortVariant,
|
|
5363
5435
|
shortVariants,
|
|
5364
5436
|
showShare,
|
|
5365
5437
|
slugify,
|
|
5366
|
-
|
|
5438
|
+
ch as snapshotUrl,
|
|
5367
5439
|
s as specHash,
|
|
5368
5440
|
stableCommand,
|
|
5369
5441
|
startExplorationOnGitHub,
|
|
@@ -5371,30 +5443,30 @@ export {
|
|
|
5371
5443
|
summarizeApprovals,
|
|
5372
5444
|
summarizeCi,
|
|
5373
5445
|
summarizeComponent,
|
|
5374
|
-
|
|
5446
|
+
ci as summarizeTokenChange,
|
|
5375
5447
|
takeMine,
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5448
|
+
cj as tarballAssetName,
|
|
5449
|
+
ck as tarballUrl,
|
|
5450
|
+
cl as teamKey,
|
|
5451
|
+
cm as teamKeyOf,
|
|
5452
|
+
cn as teamUnreadableMessage,
|
|
5453
|
+
co as teamsIn,
|
|
5382
5454
|
threeWayDiff,
|
|
5383
5455
|
tintedNeutral,
|
|
5384
|
-
|
|
5456
|
+
cp as titleOf,
|
|
5385
5457
|
titleWithJiraKey,
|
|
5386
5458
|
t2 as toAlias,
|
|
5387
|
-
|
|
5459
|
+
cq as toChangeSummary,
|
|
5388
5460
|
toConfigJson,
|
|
5389
5461
|
toHex,
|
|
5390
|
-
|
|
5462
|
+
cr as toMap,
|
|
5391
5463
|
toOklch,
|
|
5392
5464
|
toPlain,
|
|
5393
|
-
|
|
5465
|
+
cs as tokenBump,
|
|
5394
5466
|
t as tokenCssVar,
|
|
5395
5467
|
tokenFilesOf,
|
|
5396
|
-
|
|
5397
|
-
|
|
5468
|
+
ct as tokenHistory,
|
|
5469
|
+
cu as tokenNode,
|
|
5398
5470
|
tokenUsage,
|
|
5399
5471
|
tokensPath,
|
|
5400
5472
|
touchesPackages,
|
|
@@ -5402,7 +5474,7 @@ export {
|
|
|
5402
5474
|
tryTogetherUrl,
|
|
5403
5475
|
unpicked,
|
|
5404
5476
|
unreadableShipTeams,
|
|
5405
|
-
|
|
5477
|
+
cv as unreadableTeams,
|
|
5406
5478
|
updatePendingDrafts,
|
|
5407
5479
|
upsertToken,
|
|
5408
5480
|
utf8ToBase64,
|
|
@@ -5414,14 +5486,15 @@ export {
|
|
|
5414
5486
|
validatePendingDrafts,
|
|
5415
5487
|
validateProposal,
|
|
5416
5488
|
validateSet,
|
|
5417
|
-
|
|
5489
|
+
cw as valueIn,
|
|
5418
5490
|
u as valueToCss,
|
|
5419
5491
|
valuesEqual,
|
|
5420
5492
|
variantKeyOf,
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5493
|
+
cx as variantName,
|
|
5494
|
+
cy as versionTimeline,
|
|
5495
|
+
cz as visualImpactProblems,
|
|
5424
5496
|
whoCanShipSentence,
|
|
5497
|
+
withAuthorLine,
|
|
5425
5498
|
withRequestExploration,
|
|
5426
5499
|
withoutJiraKey,
|
|
5427
5500
|
writeDraftResults
|