@aspruyt/xfg 3.7.4 → 3.7.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.
package/dist/index.js CHANGED
@@ -285,6 +285,14 @@ export async function runSettings(options, processorFactory = defaultRulesetProc
285
285
  managedRulesets,
286
286
  noDelete: options.noDelete,
287
287
  });
288
+ // Print detailed ruleset plan output
289
+ if (result.planOutput && result.planOutput.lines.length > 0) {
290
+ logger.info("");
291
+ logger.info(chalk.bold(`${repoName} - Rulesets:`));
292
+ for (const line of result.planOutput.lines) {
293
+ logger.info(line);
294
+ }
295
+ }
288
296
  if (result.skipped) {
289
297
  logger.skip(i + 1, repoName, result.message);
290
298
  }
@@ -4,6 +4,7 @@ import type { ProcessorResult } from "./repository-processor.js";
4
4
  import type { RepoConfig } from "./config.js";
5
5
  /**
6
6
  * Convert RulesetProcessorResult planOutput entries to Resource objects.
7
+ * Includes the detailed plan lines in the first resource's details for display.
7
8
  */
8
9
  export declare function rulesetResultToResources(repoName: string, result: RulesetProcessorResult): Resource[];
9
10
  /**
@@ -14,6 +15,7 @@ export declare function rulesetResultToResources(repoName: string, result: Rules
14
15
  export declare function syncResultToResources(repoName: string, repoConfig: Pick<RepoConfig, "files">, result: ProcessorResult): Resource[];
15
16
  /**
16
17
  * Convert repo settings processor planOutput entries to Resource objects.
18
+ * Includes the detailed plan lines in the first resource's details for display.
17
19
  */
18
20
  export declare function repoSettingsResultToResources(repoName: string, result: {
19
21
  planOutput?: {
@@ -21,5 +23,6 @@ export declare function repoSettingsResultToResources(repoName: string, result:
21
23
  property: string;
22
24
  action: string;
23
25
  }>;
26
+ lines?: string[];
24
27
  };
25
28
  }): Resource[];
@@ -1,10 +1,13 @@
1
1
  /**
2
2
  * Convert RulesetProcessorResult planOutput entries to Resource objects.
3
+ * Includes the detailed plan lines in the first resource's details for display.
3
4
  */
4
5
  export function rulesetResultToResources(repoName, result) {
5
6
  const resources = [];
7
+ const planLines = result.planOutput?.lines ?? [];
6
8
  if (result.planOutput?.entries) {
7
- for (const entry of result.planOutput.entries) {
9
+ for (let i = 0; i < result.planOutput.entries.length; i++) {
10
+ const entry = result.planOutput.entries[i];
8
11
  let action;
9
12
  switch (entry.action) {
10
13
  case "create":
@@ -19,11 +22,14 @@ export function rulesetResultToResources(repoName, result) {
19
22
  default:
20
23
  action = "unchanged";
21
24
  }
25
+ // Attach all plan lines to first resource for GitHub summary display
26
+ const details = i === 0 && planLines.length > 0 ? { diff: planLines } : undefined;
22
27
  resources.push({
23
28
  type: "ruleset",
24
29
  repo: repoName,
25
30
  name: entry.name,
26
31
  action,
32
+ details,
27
33
  });
28
34
  }
29
35
  }
@@ -78,16 +84,22 @@ export function syncResultToResources(repoName, repoConfig, result) {
78
84
  }
79
85
  /**
80
86
  * Convert repo settings processor planOutput entries to Resource objects.
87
+ * Includes the detailed plan lines in the first resource's details for display.
81
88
  */
82
89
  export function repoSettingsResultToResources(repoName, result) {
83
90
  const resources = [];
91
+ const planLines = result.planOutput?.lines ?? [];
84
92
  if (result.planOutput?.entries) {
85
- for (const entry of result.planOutput.entries) {
93
+ for (let i = 0; i < result.planOutput.entries.length; i++) {
94
+ const entry = result.planOutput.entries[i];
95
+ // Attach all plan lines to first resource for GitHub summary display
96
+ const details = i === 0 && planLines.length > 0 ? { diff: planLines } : undefined;
86
97
  resources.push({
87
98
  type: "setting",
88
99
  repo: repoName,
89
100
  name: entry.property,
90
101
  action: entry.action === "add" ? "create" : "update",
102
+ details,
91
103
  });
92
104
  }
93
105
  }
@@ -372,10 +372,10 @@ function formatFullConfig(ruleset, indent = 2) {
372
372
  lines.push(style.color(`${pad}+ ${key}:`));
373
373
  for (const item of value) {
374
374
  if (typeof item === "object" && item !== null) {
375
- lines.push(style.color(`${pad} - ${JSON.stringify(item)}`));
375
+ lines.push(style.color(`${pad} + ${JSON.stringify(item)}`));
376
376
  }
377
377
  else {
378
- lines.push(style.color(`${pad} - ${formatValue(item)}`));
378
+ lines.push(style.color(`${pad} + ${formatValue(item)}`));
379
379
  }
380
380
  }
381
381
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspruyt/xfg",
3
- "version": "3.7.4",
3
+ "version": "3.7.6",
4
4
  "description": "CLI tool for repository-as-code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",