@aspruyt/xfg 5.1.5 → 5.1.6

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.
@@ -147,6 +147,7 @@ function formatRulesetConfigPlain(config) {
147
147
  * Shared between formatSettingsReportMarkdown and unified-summary's renderSettingsLines.
148
148
  */
149
149
  export function renderRepoSettingsDiffLines(repo, diffLines) {
150
+ const startLength = diffLines.length;
150
151
  for (const setting of repo.settings) {
151
152
  if (setting.oldValue === undefined && setting.newValue === undefined) {
152
153
  continue;
@@ -158,7 +159,15 @@ export function renderRepoSettingsDiffLines(repo, diffLines) {
158
159
  diffLines.push(`! ${setting.name}: ${formatValuePlain(setting.oldValue)} → ${formatValuePlain(setting.newValue)}`);
159
160
  }
160
161
  }
161
- for (const ruleset of repo.rulesets) {
162
+ // Blank line before rulesets if there was content above
163
+ if (repo.rulesets.length > 0 && diffLines.length > startLength) {
164
+ diffLines.push("");
165
+ }
166
+ for (let i = 0; i < repo.rulesets.length; i++) {
167
+ const ruleset = repo.rulesets[i];
168
+ // Blank line between rulesets
169
+ if (i > 0)
170
+ diffLines.push("");
162
171
  if (ruleset.action === "create") {
163
172
  diffLines.push(`+ ruleset "${ruleset.name}"`);
164
173
  if (ruleset.config) {
@@ -188,6 +197,10 @@ export function renderRepoSettingsDiffLines(repo, diffLines) {
188
197
  diffLines.push(`- ruleset "${ruleset.name}"`);
189
198
  }
190
199
  }
200
+ // Blank line before labels if there was content above
201
+ if (repo.labels.length > 0 && diffLines.length > startLength) {
202
+ diffLines.push("");
203
+ }
191
204
  for (const label of repo.labels) {
192
205
  if (label.action === "create") {
193
206
  diffLines.push(`+ label "${label.name}"`);
@@ -238,8 +251,7 @@ export function formatSettingsReportMarkdown(report, dryRun) {
238
251
  lines.push("> This was a dry run — no changes were applied");
239
252
  lines.push("");
240
253
  }
241
- // Diff block
242
- const diffLines = [];
254
+ // Per-repo sections: heading + diff block
243
255
  for (const repo of report.repos) {
244
256
  if (repo.settings.length === 0 &&
245
257
  repo.rulesets.length === 0 &&
@@ -247,14 +259,16 @@ export function formatSettingsReportMarkdown(report, dryRun) {
247
259
  !repo.error) {
248
260
  continue;
249
261
  }
250
- diffLines.push(`@@ ${repo.repoName} @@`);
251
- renderRepoSettingsDiffLines(repo, diffLines);
252
- }
253
- if (diffLines.length > 0) {
254
- lines.push("```diff");
255
- lines.push(...diffLines);
256
- lines.push("```");
262
+ lines.push(`### ${repo.repoName}`);
257
263
  lines.push("");
264
+ const diffLines = [];
265
+ renderRepoSettingsDiffLines(repo, diffLines);
266
+ if (diffLines.length > 0) {
267
+ lines.push("```diff");
268
+ lines.push(...diffLines);
269
+ lines.push("```");
270
+ lines.push("");
271
+ }
258
272
  }
259
273
  // Summary
260
274
  lines.push(`**${formatSettingsSummary(report.totals)}**`);
@@ -58,27 +58,32 @@ export function formatSyncReportMarkdown(report, dryRun) {
58
58
  lines.push("> This was a dry run — no changes were applied");
59
59
  lines.push("");
60
60
  }
61
- // Diff block
62
- const diffLines = [];
61
+ // Per-repo sections: heading + diff block
63
62
  for (const repo of report.repos) {
64
63
  if (repo.files.length === 0 && !repo.error) {
65
64
  continue;
66
65
  }
67
- diffLines.push(`@@ ${repo.repoName} @@`);
68
- renderSyncLines(repo, diffLines);
69
- }
70
- if (diffLines.length > 0) {
71
- lines.push("```diff");
72
- lines.push(...diffLines);
73
- lines.push("```");
66
+ lines.push(`### ${repo.repoName}`);
74
67
  lines.push("");
68
+ const diffLines = [];
69
+ renderSyncLines(repo, diffLines);
70
+ if (diffLines.length > 0) {
71
+ lines.push("```diff");
72
+ lines.push(...diffLines);
73
+ lines.push("```");
74
+ lines.push("");
75
+ }
75
76
  }
76
77
  // Summary
77
78
  lines.push(`**${formatSyncSummary(report.totals)}**`);
78
79
  return lines.join("\n");
79
80
  }
80
81
  export function renderSyncLines(syncRepo, diffLines) {
81
- for (const file of syncRepo.files) {
82
+ for (let i = 0; i < syncRepo.files.length; i++) {
83
+ const file = syncRepo.files[i];
84
+ // Blank line between files for readability
85
+ if (i > 0)
86
+ diffLines.push("");
82
87
  if (file.action === "create") {
83
88
  diffLines.push(`+ ${file.path}`);
84
89
  }
@@ -165,8 +165,7 @@ export function formatUnifiedSummaryMarkdown(input) {
165
165
  addRepo(r.repoName);
166
166
  for (const r of input.settings?.repos ?? [])
167
167
  addRepo(r.repoName);
168
- // Diff block
169
- const diffLines = [];
168
+ // Per-repo sections: heading + diff block
170
169
  for (const repoName of allRepos) {
171
170
  const lcAction = lifecycleByRepo.get(repoName);
172
171
  const syncRepo = syncByRepo.get(repoName);
@@ -180,19 +179,27 @@ export function formatUnifiedSummaryMarkdown(input) {
180
179
  settingsRepo.error);
181
180
  if (!hasLcChange && !hasSyncChanges && !hasSettingsChanges)
182
181
  continue;
183
- diffLines.push(`@@ ${repoName} @@`);
182
+ lines.push(`### ${repoName}`);
183
+ lines.push("");
184
+ const diffLines = [];
184
185
  if (lcAction)
185
186
  renderLifecycleLines(lcAction, diffLines);
187
+ // Blank line between lifecycle and sync sections
188
+ if (hasLcChange && hasSyncChanges)
189
+ diffLines.push("");
186
190
  if (syncRepo)
187
191
  renderSyncLines(syncRepo, diffLines);
192
+ // Blank line between files and settings sections
193
+ if (hasSyncChanges && hasSettingsChanges)
194
+ diffLines.push("");
188
195
  if (settingsRepo)
189
196
  renderRepoSettingsDiffLines(settingsRepo, diffLines);
190
- }
191
- if (diffLines.length > 0) {
192
- lines.push("```diff");
193
- lines.push(...diffLines);
194
- lines.push("```");
195
- lines.push("");
197
+ if (diffLines.length > 0) {
198
+ lines.push("```diff");
199
+ lines.push(...diffLines);
200
+ lines.push("```");
201
+ lines.push("");
202
+ }
196
203
  }
197
204
  // Combined summary
198
205
  lines.push(`**${formatCombinedSummary(input)}**`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspruyt/xfg",
3
- "version": "5.1.5",
3
+ "version": "5.1.6",
4
4
  "description": "Manage files, settings, and repositories across GitHub, Azure DevOps, and GitLab — declaratively, from a single YAML config",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",