@simplysf/simply-gitlab-core 0.2.0 → 0.4.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,96 @@
1
+ import { type GroupDesired, type ProjectDesired } from './baseline-config.js';
2
+ import type { GitLabClient } from './gitlab-client.js';
3
+ /**
4
+ * What a run would do, computed before anything is sent.
5
+ *
6
+ * A plan carries two views of the same decision: `changes`, which is what a person reads, and
7
+ * `actions`, which is what `apply` executes. They are produced together, by one pass, so apply can
8
+ * only ever do what plan showed — the alternative, re-deriving the work at apply time, is how a
9
+ * preview stops being a guarantee.
10
+ */
11
+ export interface BaselinePlan {
12
+ readonly targets: readonly TargetPlan[];
13
+ }
14
+ export interface TargetPlan {
15
+ readonly kind: 'project' | 'group';
16
+ readonly path: string;
17
+ readonly id: number;
18
+ readonly sections: readonly SectionPlan[];
19
+ /** Set when the whole target could not be planned; its sections are then empty. */
20
+ readonly error?: string;
21
+ }
22
+ export interface SectionPlan {
23
+ readonly section: string;
24
+ /** False when the instance does not offer this section — a Premium feature on a Free plan. */
25
+ readonly supported: boolean;
26
+ /** Why it is unsupported, for the plan output. */
27
+ readonly unsupportedReason?: string;
28
+ readonly changes: readonly Change[];
29
+ readonly actions: readonly Action[];
30
+ }
31
+ export type ChangeOp = 'create' | 'update' | 'delete' | 'recreate' | 'report';
32
+ export interface Change {
33
+ readonly op: ChangeOp;
34
+ /** What changed: an attribute name for `update`, an entry's identity otherwise. */
35
+ readonly key: string;
36
+ readonly from?: unknown;
37
+ readonly to?: unknown;
38
+ /** Extra context a reader needs — why a recreate, or why a delete is not being executed. */
39
+ readonly detail?: string;
40
+ }
41
+ /** One request `apply` will make. Opaque to the renderer; executed by `baseline-apply.ts`. */
42
+ export type Action = {
43
+ readonly kind: 'updateProject';
44
+ readonly body: Record<string, unknown>;
45
+ } | {
46
+ readonly kind: 'updateGroup';
47
+ readonly body: Record<string, unknown>;
48
+ } | {
49
+ readonly kind: 'protectBranch';
50
+ readonly body: Record<string, unknown>;
51
+ } | {
52
+ readonly kind: 'patchProtectedBranch';
53
+ readonly name: string;
54
+ readonly body: Record<string, unknown>;
55
+ } | {
56
+ readonly kind: 'unprotectBranch';
57
+ readonly name: string;
58
+ } | {
59
+ readonly kind: 'protectTag';
60
+ readonly body: Record<string, unknown>;
61
+ } | {
62
+ readonly kind: 'unprotectTag';
63
+ readonly name: string;
64
+ } | {
65
+ readonly kind: 'updateApprovalSettings';
66
+ readonly body: Record<string, unknown>;
67
+ } | {
68
+ readonly kind: 'createApprovalRule';
69
+ readonly body: Record<string, unknown>;
70
+ readonly branches?: readonly string[];
71
+ } | {
72
+ readonly kind: 'updateApprovalRule';
73
+ readonly ruleId: number;
74
+ readonly body: Record<string, unknown>;
75
+ readonly branches?: readonly string[];
76
+ } | {
77
+ readonly kind: 'deleteApprovalRule';
78
+ readonly ruleId: number;
79
+ } | {
80
+ readonly kind: 'setPushRules';
81
+ readonly body: Record<string, unknown>;
82
+ readonly exists: boolean;
83
+ };
84
+ /** Whether a plan would change anything if applied. */
85
+ export declare function hasChanges(plan: BaselinePlan): boolean;
86
+ /** Every drift a plan found, including the parts it would not correct. */
87
+ export declare function hasDrift(plan: BaselinePlan): boolean;
88
+ /** Plans one project. Never throws for an instance failure; the target carries the error instead. */
89
+ export declare function planProject(client: GitLabClient, target: {
90
+ readonly path: string;
91
+ readonly id: number;
92
+ }, desired: ProjectDesired): Promise<TargetPlan>;
93
+ export declare function planGroup(client: GitLabClient, target: {
94
+ readonly path: string;
95
+ readonly id: number;
96
+ }, desired: GroupDesired): Promise<TargetPlan>;
@@ -0,0 +1,412 @@
1
+ /*
2
+ * Copyright (c) 2026, SimplySF.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { entryKey, entryLabel, normalizeSection, } from './baseline-config.js';
17
+ import { AuthError, HttpError } from './errors.js';
18
+ /** Whether a plan would change anything if applied. */
19
+ export function hasChanges(plan) {
20
+ return plan.targets.some((target) => target.error !== undefined || target.sections.some((s) => s.actions.length > 0));
21
+ }
22
+ /** Every drift a plan found, including the parts it would not correct. */
23
+ export function hasDrift(plan) {
24
+ return plan.targets.some((target) => target.error !== undefined || target.sections.some((s) => s.changes.length > 0));
25
+ }
26
+ /**
27
+ * `PATCH` on a protected branch cannot change fields the config does not resend, and neither the
28
+ * approval-rule nor the branch APIs echo their inputs in the same shape they accept them. So
29
+ * comparison is by JSON value on the fields the config declares, and nothing else is looked at.
30
+ */
31
+ function sameValue(left, right) {
32
+ return JSON.stringify(normalize(left)) === JSON.stringify(normalize(right));
33
+ }
34
+ /** Sorts object keys so two equivalent objects compare equal regardless of key order. */
35
+ function normalize(value) {
36
+ if (Array.isArray(value))
37
+ return value.map(normalize);
38
+ if (typeof value === 'object' && value !== null) {
39
+ return Object.fromEntries(Object.entries(value)
40
+ .filter(([, v]) => v !== undefined)
41
+ .sort(([a], [b]) => a.localeCompare(b))
42
+ .map(([k, v]) => [k, normalize(v)]));
43
+ }
44
+ return value;
45
+ }
46
+ /**
47
+ * Diffs the attributes a config declares against what the instance reports, ignoring everything
48
+ * else. This is the whole reason a baseline is safe to run against projects that already exist:
49
+ * the blast radius is the set of keys someone wrote down.
50
+ */
51
+ function diffAttributes(desired, actual) {
52
+ const changes = [];
53
+ const body = {};
54
+ for (const [key, want] of Object.entries(desired)) {
55
+ const have = actual[key];
56
+ if (!sameValue(want, have)) {
57
+ changes.push({ op: 'update', key, from: have, to: want });
58
+ body[key] = want;
59
+ }
60
+ }
61
+ return { changes, body };
62
+ }
63
+ function asRecord(value) {
64
+ return (typeof value === 'object' && value !== null ? value : {});
65
+ }
66
+ function supported(section, changes, actions) {
67
+ return { section, supported: true, changes, actions };
68
+ }
69
+ function unsupported(section, reason) {
70
+ return { section, supported: false, unsupportedReason: reason, changes: [], actions: [] };
71
+ }
72
+ /**
73
+ * Runs a read that may not be available on this instance.
74
+ *
75
+ * Approval rules, approval settings, and push rules are Premium/Ultimate. A 403 or 404 there means
76
+ * the section does not exist rather than that the run failed, so the other sections still converge
77
+ * and the plan says which one was skipped and why.
78
+ */
79
+ async function readOptional(read) {
80
+ try {
81
+ return { ok: true, value: await read() };
82
+ }
83
+ catch (error) {
84
+ if (error instanceof AuthError && error.status === 403) {
85
+ return { ok: false, reason: 'not available to this token, or not on this plan (403)' };
86
+ }
87
+ if (error instanceof HttpError && error.status === 404) {
88
+ return { ok: false, reason: 'not available on this instance (404)' };
89
+ }
90
+ throw error;
91
+ }
92
+ }
93
+ // --- Section planners ---------------------------------------------------------------------------
94
+ async function planSettings(client, ref, desired) {
95
+ if (desired.settings === undefined)
96
+ return [];
97
+ const actual = asRecord(await client.getProject(ref));
98
+ const { changes, body } = diffAttributes(desired.settings, actual);
99
+ return [supported('settings', changes, changes.length === 0 ? [] : [{ kind: 'updateProject', body }])];
100
+ }
101
+ /**
102
+ * Protected branches, which are the one section where the update mechanism materially changes what
103
+ * a plan means. `PATCH` corrects a protection in place; a rename cannot be patched, so it reads as
104
+ * a delete and a create — and that pair leaves the branch unprotected in between, which the plan
105
+ * labels rather than leaving anyone to discover.
106
+ */
107
+ async function planProtectedBranches(client, ref, desired) {
108
+ const section = normalizeSection(desired.protectedBranches);
109
+ if (section === undefined)
110
+ return [];
111
+ const actual = (await client.listProtectedBranches(ref)).items.map(asRecord);
112
+ return [
113
+ planKeyedSection('protectedBranches', section, actual, {
114
+ create: (entry) => ({ kind: 'protectBranch', body: { ...entry } }),
115
+ update: (entry, body) => ({ kind: 'patchProtectedBranch', name: String(entry.name), body }),
116
+ remove: (entry) => ({ kind: 'unprotectBranch', name: String(entry.name) }),
117
+ }),
118
+ ];
119
+ }
120
+ /** Protected tags have no update endpoint, so a change is a delete and a create, and says so. */
121
+ async function planProtectedTags(client, ref, desired) {
122
+ const section = normalizeSection(desired.protectedTags);
123
+ if (section === undefined)
124
+ return [];
125
+ const actual = (await client.listProtectedTags(ref)).items.map(asRecord);
126
+ return [
127
+ planKeyedSection('protectedTags', section, actual, {
128
+ create: (entry) => ({ kind: 'protectTag', body: { ...entry } }),
129
+ update: (entry) => ({ kind: 'protectTag', body: { ...entry } }),
130
+ remove: (entry) => ({ kind: 'unprotectTag', name: String(entry.name) }),
131
+ recreate: 'protected tags have no update endpoint, so this is a delete and a create',
132
+ beforeUpdate: (entry) => ({ kind: 'unprotectTag', name: String(entry.name) }),
133
+ }),
134
+ ];
135
+ }
136
+ async function planApprovals(client, ref, desired) {
137
+ if (desired.approvals === undefined)
138
+ return [];
139
+ const read = await readOptional(() => client.getApprovalSettings(ref));
140
+ if (!read.ok)
141
+ return [unsupported('approvals', read.reason)];
142
+ const { changes, body } = diffAttributes(desired.approvals, asRecord(read.value));
143
+ return [supported('approvals', changes, changes.length === 0 ? [] : [{ kind: 'updateApprovalSettings', body }])];
144
+ }
145
+ /**
146
+ * Approval rules, where the config speaks in names and the API speaks in ids.
147
+ *
148
+ * `usernames` the API takes directly. Group paths and protected-branch names it does not, so those
149
+ * are carried on the action and resolved at apply time — the branch ids in particular cannot be
150
+ * resolved now, because the branch may be created by the section that runs immediately before this
151
+ * one.
152
+ */
153
+ async function planApprovalRules(client, ref, desired) {
154
+ const section = normalizeSection(desired.approvalRules);
155
+ if (section === undefined)
156
+ return [];
157
+ const read = await readOptional(() => client.listApprovalRules(ref));
158
+ if (!read.ok)
159
+ return [unsupported('approvalRules', read.reason)];
160
+ const actual = read.value.items.map(asRecord);
161
+ const byName = new Map(actual.map((rule) => [String(rule.name), rule]));
162
+ const changes = [];
163
+ const actions = [];
164
+ for (const entry of section.entries) {
165
+ const name = String(entry.name);
166
+ const branches = Array.isArray(entry.protectedBranches) ? entry.protectedBranches : undefined;
167
+ const body = ruleBody(entry);
168
+ const existing = byName.get(name);
169
+ if (existing === undefined) {
170
+ changes.push({ op: 'create', key: name, to: summarise(entry) });
171
+ actions.push({ kind: 'createApprovalRule', body, branches });
172
+ continue;
173
+ }
174
+ const attributeChanges = compareRule(entry, existing);
175
+ if (attributeChanges.length > 0) {
176
+ changes.push(...attributeChanges.map((change) => ({ ...change, key: `${name}.${change.key}` })));
177
+ actions.push({ kind: 'updateApprovalRule', ruleId: Number(existing.id), body, branches });
178
+ }
179
+ }
180
+ const declared = new Set(section.entries.map((entry) => String(entry.name)));
181
+ for (const rule of actual) {
182
+ const name = String(rule.name);
183
+ // `any_approver` is GitLab's implicit fallback rule, not something a config declared or should
184
+ // delete; pruning it would remove the project's default approval behaviour.
185
+ if (declared.has(name) || rule.rule_type === 'any_approver')
186
+ continue;
187
+ changes.push({
188
+ op: 'delete',
189
+ key: name,
190
+ detail: section.prune ? undefined : 'not pruned; set "prune": true on this section to remove it',
191
+ });
192
+ if (section.prune)
193
+ actions.push({ kind: 'deleteApprovalRule', ruleId: Number(rule.id) });
194
+ }
195
+ return [supported('approvalRules', changes, actions)];
196
+ }
197
+ /** The rule attributes the API accepts, with the config's name-based references left off. */
198
+ function ruleBody(entry) {
199
+ const body = {};
200
+ for (const [key, value] of Object.entries(entry)) {
201
+ if (key === 'protectedBranches' || key === 'groups')
202
+ continue;
203
+ body[key] = value;
204
+ }
205
+ return body;
206
+ }
207
+ /** Compares only what the config declared, translating its name-based fields onto the payload. */
208
+ function compareRule(entry, actual) {
209
+ const changes = [];
210
+ for (const [key, want] of Object.entries(entry)) {
211
+ if (key === 'name')
212
+ continue;
213
+ if (key === 'usernames') {
214
+ const have = (Array.isArray(actual.eligible_approvers) ? actual.eligible_approvers : [])
215
+ .map((user) => asRecord(user).username)
216
+ .filter((username) => typeof username === 'string');
217
+ if (!sameValue([...want].sort(), [...have].sort())) {
218
+ changes.push({ op: 'update', key, from: have, to: want });
219
+ }
220
+ continue;
221
+ }
222
+ if (key === 'groups') {
223
+ const have = (Array.isArray(actual.groups) ? actual.groups : [])
224
+ .map((group) => asRecord(group).full_path)
225
+ .filter((path) => typeof path === 'string');
226
+ if (!sameValue([...want].sort(), [...have].sort())) {
227
+ changes.push({ op: 'update', key, from: have, to: want });
228
+ }
229
+ continue;
230
+ }
231
+ if (key === 'protectedBranches') {
232
+ const have = (Array.isArray(actual.protected_branches) ? actual.protected_branches : [])
233
+ .map((branch) => asRecord(branch).name)
234
+ .filter((name) => typeof name === 'string');
235
+ if (!sameValue([...want].sort(), [...have].sort())) {
236
+ changes.push({ op: 'update', key, from: have, to: want });
237
+ }
238
+ continue;
239
+ }
240
+ if (!sameValue(want, actual[key]))
241
+ changes.push({ op: 'update', key, from: actual[key], to: want });
242
+ }
243
+ return changes;
244
+ }
245
+ async function planPushRules(client, ref, desired) {
246
+ if (desired.pushRules === undefined)
247
+ return [];
248
+ const read = await readOptional(() => client.getPushRules(ref));
249
+ if (!read.ok)
250
+ return [unsupported('pushRules', read.reason)];
251
+ // A project with no push rules answers 200 with null rather than 404.
252
+ const existing = read.value !== null && read.value !== undefined;
253
+ const { changes, body } = diffAttributes(desired.pushRules, asRecord(read.value));
254
+ return [
255
+ supported('pushRules', changes, changes.length === 0 ? [] : [{ kind: 'setPushRules', body, exists: existing }]),
256
+ ];
257
+ }
258
+ /**
259
+ * Variables are reported, never written.
260
+ *
261
+ * Both POST and PUT require a `value`, and a `masked_and_hidden` variable's value is not even
262
+ * readable, so there is no honest way to reconcile them from a config that by design holds no
263
+ * values. Naming which projects are missing a key is still the question people actually ask.
264
+ */
265
+ async function planVariables(client, ref, desired) {
266
+ const section = normalizeSection(desired.variables);
267
+ if (section === undefined)
268
+ return [];
269
+ const read = await readOptional(() => client.listVariables(ref, 200));
270
+ if (!read.ok)
271
+ return [unsupported('variables', read.reason)];
272
+ const actual = read.value.items.map(asRecord);
273
+ const byKey = new Map(actual.map((variable) => [entryKey('variables', variable), variable]));
274
+ const changes = [];
275
+ for (const entry of section.entries) {
276
+ const existing = byKey.get(entryKey('variables', entry));
277
+ const label = entryLabel('variables', entry);
278
+ if (existing === undefined) {
279
+ changes.push({ op: 'report', key: label, detail: 'missing; create it with a value by hand' });
280
+ continue;
281
+ }
282
+ for (const [attribute, want] of Object.entries(entry)) {
283
+ if (attribute === 'key' || attribute === 'environment_scope')
284
+ continue;
285
+ if (!sameValue(want, existing[attribute])) {
286
+ changes.push({
287
+ op: 'report',
288
+ key: `${label}.${attribute}`,
289
+ from: existing[attribute],
290
+ to: want,
291
+ detail: 'cannot be corrected without resending the value',
292
+ });
293
+ }
294
+ }
295
+ }
296
+ // Deliberately no `actions`: this section never writes, whatever `prune` says.
297
+ return [supported('variables', changes, [])];
298
+ }
299
+ /** A short description of an entry, for a create line in the plan. */
300
+ function summarise(entry) {
301
+ return Object.entries(entry)
302
+ .filter(([key]) => key !== 'name')
303
+ .map(([key, value]) => `${key}: ${Array.isArray(value) ? value.join(', ') : String(value)}`)
304
+ .join(', ');
305
+ }
306
+ /** The shared shape of every keyed list section: create what is missing, correct what differs. */
307
+ function planKeyedSection(section, desired, actual, handlers) {
308
+ const byKey = new Map(actual.map((item) => [entryKey(section, item), item]));
309
+ const changes = [];
310
+ const actions = [];
311
+ for (const entry of desired.entries) {
312
+ const key = entryKey(section, entry);
313
+ const label = entryLabel(section, entry);
314
+ const existing = byKey.get(key);
315
+ if (existing === undefined) {
316
+ changes.push({ op: 'create', key: label, to: summarise(entry) });
317
+ actions.push(handlers.create(entry));
318
+ continue;
319
+ }
320
+ const declared = Object.fromEntries(Object.entries(entry).filter(([field]) => field !== 'name'));
321
+ const { changes: attributeChanges, body } = diffAttributes(declared, existing);
322
+ if (attributeChanges.length === 0)
323
+ continue;
324
+ if (handlers.recreate !== undefined) {
325
+ changes.push(...attributeChanges.map((change) => ({ ...change, key: `${label}.${change.key}`, detail: handlers.recreate })));
326
+ if (handlers.beforeUpdate)
327
+ actions.push(handlers.beforeUpdate(entry));
328
+ actions.push(handlers.update(entry, body));
329
+ }
330
+ else {
331
+ changes.push(...attributeChanges.map((change) => ({ ...change, key: `${label}.${change.key}` })));
332
+ actions.push(handlers.update(entry, body));
333
+ }
334
+ }
335
+ const declaredKeys = new Set(desired.entries.map((entry) => entryKey(section, entry)));
336
+ for (const item of actual) {
337
+ const key = entryKey(section, item);
338
+ if (declaredKeys.has(key))
339
+ continue;
340
+ changes.push({
341
+ op: 'delete',
342
+ key: entryLabel(section, item),
343
+ detail: desired.prune ? undefined : 'not pruned; set "prune": true on this section to remove it',
344
+ });
345
+ if (desired.prune)
346
+ actions.push(handlers.remove(item));
347
+ }
348
+ return supported(section, changes, actions);
349
+ }
350
+ // --- Target planners ----------------------------------------------------------------------------
351
+ /**
352
+ * The order sections are planned and applied in. Settings first because some of them gate what the
353
+ * later ones can set; approval rules after protected branches because a rule scoped to a branch
354
+ * needs that branch to exist before it can reference it.
355
+ */
356
+ const PROJECT_PLANNERS = [
357
+ planSettings,
358
+ planProtectedBranches,
359
+ planProtectedTags,
360
+ planApprovals,
361
+ planApprovalRules,
362
+ planPushRules,
363
+ planVariables,
364
+ ];
365
+ /** Plans one project. Never throws for an instance failure; the target carries the error instead. */
366
+ export async function planProject(client, target, desired) {
367
+ const sections = [];
368
+ try {
369
+ /* Sections are read in a fixed order rather than concurrently: the order is part of the
370
+ contract, and a project's own reads are not the bottleneck across fifty of them. */
371
+ /* eslint-disable no-await-in-loop */
372
+ for (const planner of PROJECT_PLANNERS) {
373
+ sections.push(...(await planner(client, target.path, desired)));
374
+ }
375
+ /* eslint-enable no-await-in-loop */
376
+ }
377
+ catch (error) {
378
+ return {
379
+ kind: 'project',
380
+ path: target.path,
381
+ id: target.id,
382
+ sections,
383
+ error: error instanceof Error ? error.message : String(error),
384
+ };
385
+ }
386
+ return { kind: 'project', path: target.path, id: target.id, sections };
387
+ }
388
+ export async function planGroup(client, target, desired) {
389
+ if (desired.settings === undefined) {
390
+ return { kind: 'group', path: target.path, id: target.id, sections: [] };
391
+ }
392
+ try {
393
+ const actual = asRecord(await client.getGroup(target.path));
394
+ const { changes, body } = diffAttributes(desired.settings, actual);
395
+ return {
396
+ kind: 'group',
397
+ path: target.path,
398
+ id: target.id,
399
+ sections: [supported('settings', changes, changes.length === 0 ? [] : [{ kind: 'updateGroup', body }])],
400
+ };
401
+ }
402
+ catch (error) {
403
+ return {
404
+ kind: 'group',
405
+ path: target.path,
406
+ id: target.id,
407
+ sections: [],
408
+ error: error instanceof Error ? error.message : String(error),
409
+ };
410
+ }
411
+ }
412
+ //# sourceMappingURL=baseline-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseline-plan.js","sourceRoot":"","sources":["../src/baseline-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAEL,QAAQ,EACR,UAAU,EAGV,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAsEnD,uDAAuD;AACvD,MAAM,UAAU,UAAU,CAAC,IAAkB;IAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;AACxH,CAAC;AAED,0EAA0E;AAC1E,MAAM,UAAU,QAAQ,CAAC,IAAkB;IACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,M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target by target, with a closing summary. */
4
+ export declare function renderPlan(plan: BaselinePlan): string;
5
+ /**
6
+ * The plan as data, for `--json` and for the MCP tool.
7
+ *
8
+ * `actions` are deliberately dropped: they are how apply executes, not something a caller should
9
+ * depend on, and publishing them would make an internal shape part of the contract.
10
+ */
11
+ export declare function planToJson(plan: BaselinePlan): unknown;
12
+ /** What an apply actually did, after the fact. */
13
+ export declare function renderApply(result: ApplyResult): string;