@aspruyt/xfg 8.5.4 → 8.5.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.
@@ -141,6 +141,8 @@ function mergeLabels(rootLabels, repoLabels) {
141
141
  const repoLabel = repo[name];
142
142
  if (repoLabel === false)
143
143
  continue;
144
+ if (rootLabel === false && !repoLabel)
145
+ continue;
144
146
  if (!inheritLabels && !repoLabel && rootLabel)
145
147
  continue;
146
148
  const base = rootLabel && typeof rootLabel === "object" ? rootLabel : {};
@@ -324,7 +326,7 @@ export function mergeSettings(root, perRepo) {
324
326
  for (const name of allRulesetNames) {
325
327
  const rootRuleset = rootRulesets[name];
326
328
  const repoRuleset = repoRulesets[name];
327
- if (repoRuleset === false) {
329
+ if (repoRuleset === false || (rootRuleset === false && !repoRuleset)) {
328
330
  continue;
329
331
  }
330
332
  if (!inheritRulesets && !repoRuleset && rootRuleset) {
@@ -25,6 +25,7 @@ interface PROptions {
25
25
  aiSummary?: string;
26
26
  }
27
27
  export type { PRResult } from "./types.js";
28
+ export declare function loadDefaultTemplate(templatePath?: string): string;
28
29
  /**
29
30
  * Format PR body using template with ${xfg:...} variables.
30
31
  *
@@ -1,34 +1,20 @@
1
- import { readFileSync, existsSync } from "node:fs";
1
+ import { readFileSync } from "node:fs";
2
2
  import { join, dirname } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { createPRStrategy } from "./pr-strategy-factory.js";
5
5
  import { PRWorkflowExecutor } from "./pr-strategy.js";
6
6
  import { interpolateXfgContent } from "../shared/xfg-template.js";
7
7
  import { inlineCode } from "../shared/markdown-fence.js";
8
- function loadDefaultTemplate() {
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
- const templatePath = join(__dirname, "..", "PR.md");
12
- if (existsSync(templatePath)) {
8
+ import { toErrorMessage } from "../shared/type-guards.js";
9
+ import { SyncError } from "../shared/errors.js";
10
+ const DEFAULT_TEMPLATE_PATH = join(dirname(fileURLToPath(import.meta.url)), "..", "..", "PR.md");
11
+ export function loadDefaultTemplate(templatePath = DEFAULT_TEMPLATE_PATH) {
12
+ try {
13
13
  return readFileSync(templatePath, "utf-8");
14
14
  }
15
- return `## Summary
16
-
17
- Automated sync of configuration files to \${xfg:repo.fullName}.
18
-
19
- \${xfg:pr.aiSummary}
20
-
21
- ## Changes
22
-
23
- \${xfg:pr.fileChanges}
24
-
25
- ## Source
26
-
27
- Configuration synced using [xfg](https://github.com/anthony-spruyt/xfg).
28
-
29
- ---
30
-
31
- _This PR was automatically generated by [xfg](https://github.com/anthony-spruyt/xfg)_`;
15
+ catch (error) {
16
+ throw new SyncError(`Failed to read default PR template ${templatePath}: ${toErrorMessage(error)}`, { cause: error });
17
+ }
32
18
  }
33
19
  const AI_SUMMARY_VAR = "${xfg:pr.aiSummary}";
34
20
  const UNESCAPED_AI_SUMMARY_VAR = /(?<!\$)\$\{xfg:pr\.aiSummary\}/;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspruyt/xfg",
3
- "version": "8.5.4",
3
+ "version": "8.5.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",