@bridge-ds/core 0.19.0 → 0.20.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.
@@ -247,6 +247,12 @@ export interface BranchVerdictInput {
247
247
  * approval was in (/api/ship, decision TV-1). With `tokenValues` and the design approval, it reads `autoShip`.
248
248
  */
249
249
  autoMerge?: boolean | null | undefined;
250
+ /**
251
+ * A lead published this Tier 1 change without review (the app's review starts with TIER1_PUBLISH_HEADING, on the
252
+ * head commit; docs/GOVERNANCE.md "Tier 1 publish by leads"). With `autoMerge` and the checks not failing, it reads
253
+ * `autoShip`. A failing check drops it back to review: the status reads as any other change waiting for an approval.
254
+ */
255
+ tier1Published?: boolean | null | undefined;
250
256
  /**
251
257
  * The reviewers to look again (lookAgainReviewers over the reviews and the head sha): the author updated the branch
252
258
  * after every changes request. The status stays `changes-requested` and the merge stays blocked; only its words say
@@ -1,5 +1,5 @@
1
- import type { Owners } from './config';
2
- import { type ApprovalRole, type ApprovalSummary } from './review-gate';
1
+ import type { OverridePolicy, Owners } from './config';
2
+ import { type ApprovalRole, type ApprovalSummary, type MissingApproval } from './review-gate';
3
3
  import { type Rights } from './rights';
4
4
  import type { RiskTier } from './risk';
5
5
  import type { TeamStates } from './teams';
@@ -51,13 +51,54 @@ export interface SuggestionGovernance {
51
51
  teams?: TeamStates | null | undefined;
52
52
  /** `governance.soloOwnerCanApproveBoth`: the only owner's approval covers design and tech (review-gate summarizeApprovals). */
53
53
  soloOwnerCanApproveBoth?: boolean | undefined;
54
+ /**
55
+ * `governance.override`: an owner it allows, whom nobody else can review, approves their own suggestion as owner with
56
+ * a written reason (suggestionOverrideOf, docs/GOVERNANCE.md "Owner override"). Absent: no override.
57
+ */
58
+ override?: OverridePolicy | null | undefined;
54
59
  }
55
60
  export interface SuggestionApprovals extends ApprovalSummary {
56
61
  /** People whose latest review is on an older payload: it no longer counts. */
57
62
  stale: string[];
58
63
  /** People whose review does not count because they are not owners (or not collaborators when no owner is set). */
59
64
  ignored: string[];
65
+ /** Approved with the owner override on this version (suggestionOverrideOf): who, why, and what it went without. */
66
+ override?: SuggestionOverrideRecord | undefined;
60
67
  }
68
+ export declare const SUGGESTION_OVERRIDE_MARK = "bridge-suggestion-override";
69
+ export interface SuggestionOverrideRecord {
70
+ login: string;
71
+ reason: string;
72
+ missing: string[];
73
+ /** The version it was approved on (suggestionPayloadSha). */
74
+ payloadSha: string;
75
+ }
76
+ /** The override comment: the PR override's audit line ("Approved as owner from Bridge."), the version, the record. */
77
+ export declare function composeSuggestionOverrideComment(r: {
78
+ login: string;
79
+ reason: string;
80
+ missing: MissingApproval[];
81
+ payloadSha: string;
82
+ }): string;
83
+ /** Reads an override comment on a suggestion back; null for any other comment. */
84
+ export declare function parseSuggestionOverrideComment(body: string | null | undefined): SuggestionOverrideRecord | null;
85
+ /**
86
+ * Who may approve this suggestion as owner, and why not: an owner `governance.override` allows (overrideHolders), on
87
+ * their own suggestion, when nobody else in the approver lists can review it. Null when they may.
88
+ */
89
+ export declare function suggestionOverrideProblem(x: {
90
+ viewer: string | null | undefined;
91
+ author: string;
92
+ gov: SuggestionGovernance;
93
+ }): string | null;
94
+ /**
95
+ * The owner override in force on this version: the latest override comment for `payloadSha`, posted by the person it
96
+ * names, who may use it (suggestionOverrideProblem) with a reason long enough. Null otherwise.
97
+ */
98
+ export declare function suggestionOverrideOf(comments: readonly SuggestionCommentLike[], gov: SuggestionGovernance, opts: {
99
+ payloadSha: string;
100
+ author?: string | null | undefined;
101
+ }): SuggestionOverrideRecord | null;
61
102
  /**
62
103
  * Approvals on a suggestion, as summarizeApprovals counts them on a pull request, from the review comments: only
63
104
  * comments by people in the approver lists (governance owners and rights) count; with no owner configured at all, only
@@ -2,7 +2,7 @@ import { GitHubClient, type IssueSummary, type PullRequestSummary } from './gith
2
2
  import { type Requester } from './requester';
3
3
  import { type SuggestionAppliedRecord, type SuggestionApprovals, type SuggestionCommentLike, type SuggestionGovernance, type SuggestionReviewEvent } from './suggestion-review';
4
4
  import { type ComposeSuggestionOptions, type ParsedSuggestion, type SuggestionKind, type SuggestionPayloadV1, type SuggestionStatus } from './suggestions';
5
- import type { ApprovalRole } from './review-gate';
5
+ import { type ApprovalRole } from './review-gate';
6
6
  import { type BridgeConfig } from './config';
7
7
  import { type SuggestionApplyOp, type SuggestionApplyPlan, type SuggestionWorkspace } from './suggestion-apply';
8
8
  export interface CreatedSuggestion {
@@ -174,6 +174,17 @@ export declare function reviewSuggestionOnGitHub(gh: GitHubClient, n: number, in
174
174
  by?: string | undefined;
175
175
  at?: Date | undefined;
176
176
  }, gov: SuggestionGovernance): Promise<SuggestionReviewResult>;
177
+ /**
178
+ * The owner override on a suggestion (docs/GOVERNANCE.md "Owner override"): the owner it allows, whom nobody else can
179
+ * review, approves their own suggestion as owner with a written reason. Checks the rule (suggestionOverrideProblem),
180
+ * the reason (overrideReasonProblem), the version, then posts the audit comment and re-syncs the state label. A
181
+ * developer then applies it as any approved suggestion; the pull request carries the approvals.
182
+ */
183
+ export declare function overrideSuggestionOnGitHub(gh: GitHubClient, n: number, input: {
184
+ reason: string;
185
+ payloadSha?: string | undefined;
186
+ by?: string | undefined;
187
+ }, gov: SuggestionGovernance): Promise<SuggestionReviewResult>;
177
188
  /**
178
189
  * Records that a suggestion is being applied (the applied marker comment) and sets its status label: "suggestion:
179
190
  * applying" while the pull request is open, "suggestion: applied" (the old labels removed) once it merged or the issue
@@ -0,0 +1,48 @@
1
+ import type { Owners } from './config';
2
+ import type { RiskTier } from './risk';
3
+ /** The setting, absent counting as on. */
4
+ export declare const leadsPublishTier1On: (gov: {
5
+ leadsPublishTier1?: boolean | undefined;
6
+ } | null | undefined) => boolean;
7
+ /** Which reviewers lead a Tier 1 change: tech when it touches stories or tests (code-only Tier 1), else design. */
8
+ export type Tier1Domain = 'design' | 'tech';
9
+ export declare function tier1Domain(paths: readonly string[]): Tier1Domain;
10
+ export interface Tier1PublishInput {
11
+ /** Login of the person publishing (the pull request's author). */
12
+ viewer: string | null | undefined;
13
+ /** classifyRisk over the change. Only Tier 1 publishes without review. */
14
+ tier: RiskTier | null | undefined;
15
+ domain: Tier1Domain;
16
+ /** The approver lists (approverLists: rights applied, teams expanded). */
17
+ approvers: Owners;
18
+ /** The viewer is an admin of the team in Bridge. */
19
+ admin: boolean;
20
+ /** governance.leadsPublishTier1 (leadsPublishTier1On). */
21
+ enabled: boolean;
22
+ }
23
+ /** Whether this person may publish this change without review. */
24
+ export declare function canPublishTier1(x: Tier1PublishInput): boolean;
25
+ /** The button that replaces "Send for review" for someone who may publish. */
26
+ export declare const PUBLISH_LABEL = "Publish";
27
+ /** The first line of the app's review on the pull request: how History and the readers recognise it. */
28
+ export declare const TIER1_PUBLISH_HEADING = "**Bridge: published without review (Tier 1)**";
29
+ /** The record, on the pull request and in History. */
30
+ export declare const publishedWithoutReview: (name: string) => string;
31
+ /** The app's review body: the heading, then the record and why it needed no review. */
32
+ export declare function tier1PublishReviewBody(name: string, login: string): string;
33
+ /** Who published it, read back from the app's review body, or null when the body is not one. */
34
+ export declare function tier1PublishedBy(body: string | null | undefined): string | null;
35
+ /**
36
+ * Who published this pull request without review, read from its reviews: the app's approving review with the heading,
37
+ * on the head commit when the head is known (an older one was dismissed by the push after it). Null when none.
38
+ */
39
+ export declare function tier1PublishOf(reviews: readonly {
40
+ state: string;
41
+ body?: string | null | undefined;
42
+ commit_id?: string | null | undefined;
43
+ }[] | null | undefined, headSha?: string | null | undefined): string | null;
44
+ /**
45
+ * Who may publish without review, in one sentence, for the CLI, the MCP server and Settings. Admins are a Bridge
46
+ * team role, so the sentence names the role, not people.
47
+ */
48
+ export declare function tier1PublishSentence(enabled: boolean): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bridge-ds/core",
3
- "version": "0.19.0",
3
+ "version": "0.20.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",