@aspruyt/xfg 4.0.0 → 4.0.1

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.
Files changed (173) hide show
  1. package/dist/cli/index.d.ts +1 -2
  2. package/dist/cli/index.js +0 -1
  3. package/dist/cli/program.js +7 -2
  4. package/dist/cli/{settings/results-collector.d.ts → results-collector.d.ts} +1 -1
  5. package/dist/cli/{settings/results-collector.js → results-collector.js} +2 -1
  6. package/dist/cli/settings-report-builder.d.ts +1 -3
  7. package/dist/cli/sync-command.d.ts +2 -24
  8. package/dist/cli/sync-command.js +295 -301
  9. package/dist/cli/types.d.ts +60 -40
  10. package/dist/cli/types.js +1 -12
  11. package/dist/config/errors.d.ts +9 -0
  12. package/dist/config/errors.js +11 -0
  13. package/dist/config/file-reference-resolver.d.ts +2 -1
  14. package/dist/config/file-reference-resolver.js +10 -8
  15. package/dist/config/formatter.d.ts +3 -2
  16. package/dist/config/index.d.ts +4 -6
  17. package/dist/config/index.js +4 -8
  18. package/dist/config/loader.js +4 -2
  19. package/dist/config/merge.d.ts +0 -9
  20. package/dist/config/merge.js +2 -7
  21. package/dist/config/normalizer.d.ts +4 -0
  22. package/dist/config/normalizer.js +61 -110
  23. package/dist/config/types.d.ts +15 -19
  24. package/dist/config/types.js +1 -1
  25. package/dist/config/validator.d.ts +0 -4
  26. package/dist/config/validator.js +286 -363
  27. package/dist/config/validators/file-validator.d.ts +2 -8
  28. package/dist/config/validators/file-validator.js +6 -17
  29. package/dist/config/validators/index.d.ts +3 -3
  30. package/dist/config/validators/index.js +3 -3
  31. package/dist/config/validators/repo-settings-validator.d.ts +0 -6
  32. package/dist/config/validators/repo-settings-validator.js +9 -9
  33. package/dist/config/validators/ruleset-validator.d.ts +0 -14
  34. package/dist/config/validators/ruleset-validator.js +28 -28
  35. package/dist/lifecycle/ado-migration-source.js +2 -1
  36. package/dist/lifecycle/github-lifecycle-provider.d.ts +6 -5
  37. package/dist/lifecycle/github-lifecycle-provider.js +79 -90
  38. package/dist/lifecycle/index.d.ts +2 -6
  39. package/dist/lifecycle/index.js +0 -4
  40. package/dist/lifecycle/lifecycle-formatter.d.ts +2 -1
  41. package/dist/lifecycle/lifecycle-formatter.js +4 -0
  42. package/dist/lifecycle/lifecycle-helpers.d.ts +3 -2
  43. package/dist/lifecycle/repo-lifecycle-manager.js +4 -11
  44. package/dist/lifecycle/types.d.ts +0 -8
  45. package/dist/output/github-summary.d.ts +5 -0
  46. package/dist/output/github-summary.js +9 -2
  47. package/dist/output/index.d.ts +2 -2
  48. package/dist/output/index.js +1 -1
  49. package/dist/output/lifecycle-report.js +5 -23
  50. package/dist/output/settings-report.d.ts +14 -3
  51. package/dist/output/settings-report.js +137 -197
  52. package/dist/output/summary-utils.d.ts +1 -1
  53. package/dist/output/summary-utils.js +2 -1
  54. package/dist/output/sync-report.js +5 -8
  55. package/dist/output/unified-summary.d.ts +2 -1
  56. package/dist/output/unified-summary.js +71 -133
  57. package/dist/settings/base-processor.d.ts +67 -0
  58. package/dist/settings/base-processor.js +91 -0
  59. package/dist/settings/index.d.ts +4 -3
  60. package/dist/settings/index.js +3 -3
  61. package/dist/settings/labels/converter.d.ts +2 -1
  62. package/dist/settings/labels/github-labels-strategy.d.ts +9 -18
  63. package/dist/settings/labels/github-labels-strategy.js +17 -73
  64. package/dist/settings/labels/index.d.ts +2 -6
  65. package/dist/settings/labels/index.js +1 -9
  66. package/dist/settings/labels/processor.d.ts +6 -30
  67. package/dist/settings/labels/processor.js +62 -152
  68. package/dist/settings/labels/types.d.ts +5 -8
  69. package/dist/settings/repo-settings/formatter.d.ts +2 -2
  70. package/dist/settings/repo-settings/formatter.js +6 -6
  71. package/dist/settings/repo-settings/github-repo-settings-strategy.d.ts +11 -12
  72. package/dist/settings/repo-settings/github-repo-settings-strategy.js +32 -79
  73. package/dist/settings/repo-settings/index.d.ts +2 -5
  74. package/dist/settings/repo-settings/index.js +1 -9
  75. package/dist/settings/repo-settings/processor.d.ts +6 -27
  76. package/dist/settings/repo-settings/processor.js +51 -104
  77. package/dist/settings/repo-settings/types.d.ts +7 -9
  78. package/dist/settings/rulesets/diff-algorithm.d.ts +0 -4
  79. package/dist/settings/rulesets/diff-algorithm.js +1 -10
  80. package/dist/settings/rulesets/diff.d.ts +1 -1
  81. package/dist/settings/rulesets/diff.js +2 -21
  82. package/dist/settings/rulesets/formatter.d.ts +1 -3
  83. package/dist/settings/rulesets/formatter.js +1 -8
  84. package/dist/settings/rulesets/github-ruleset-strategy.d.ts +11 -51
  85. package/dist/settings/rulesets/github-ruleset-strategy.js +24 -85
  86. package/dist/settings/rulesets/index.d.ts +3 -6
  87. package/dist/settings/rulesets/index.js +5 -9
  88. package/dist/settings/rulesets/processor.d.ts +8 -33
  89. package/dist/settings/rulesets/processor.js +58 -151
  90. package/dist/settings/rulesets/types.d.ts +35 -6
  91. package/dist/shared/command-executor.d.ts +2 -22
  92. package/dist/shared/command-executor.js +8 -7
  93. package/dist/shared/env.d.ts +0 -8
  94. package/dist/shared/env.js +14 -70
  95. package/dist/shared/file-status.d.ts +2 -0
  96. package/dist/shared/file-status.js +13 -0
  97. package/dist/shared/gh-api-utils.d.ts +46 -0
  98. package/dist/shared/gh-api-utils.js +107 -0
  99. package/dist/shared/index.d.ts +5 -5
  100. package/dist/shared/index.js +3 -3
  101. package/dist/shared/interpolation-engine.d.ts +31 -0
  102. package/dist/shared/interpolation-engine.js +50 -0
  103. package/dist/shared/logger.d.ts +3 -7
  104. package/dist/shared/logger.js +4 -1
  105. package/dist/shared/repo-detector.d.ts +17 -2
  106. package/dist/shared/repo-detector.js +27 -0
  107. package/dist/shared/retry-utils.d.ts +9 -17
  108. package/dist/shared/retry-utils.js +22 -28
  109. package/dist/shared/sanitize-utils.d.ts +0 -7
  110. package/dist/shared/sanitize-utils.js +0 -7
  111. package/dist/shared/shell-utils.d.ts +1 -0
  112. package/dist/shared/shell-utils.js +3 -0
  113. package/dist/shared/string-utils.d.ts +4 -0
  114. package/dist/shared/string-utils.js +6 -0
  115. package/dist/shared/type-guards.d.ts +17 -0
  116. package/dist/shared/type-guards.js +26 -0
  117. package/dist/shared/workspace-utils.d.ts +0 -4
  118. package/dist/shared/workspace-utils.js +0 -4
  119. package/dist/{sync → shared}/xfg-template.d.ts +3 -2
  120. package/dist/{sync → shared}/xfg-template.js +13 -54
  121. package/dist/sync/auth-options-builder.d.ts +4 -5
  122. package/dist/sync/auth-options-builder.js +15 -26
  123. package/dist/sync/branch-manager.d.ts +5 -0
  124. package/dist/sync/branch-manager.js +12 -10
  125. package/dist/sync/commit-push-manager.d.ts +1 -1
  126. package/dist/sync/commit-push-manager.js +22 -18
  127. package/dist/sync/diff-utils.d.ts +4 -9
  128. package/dist/sync/diff-utils.js +2 -19
  129. package/dist/sync/file-sync-orchestrator.js +9 -8
  130. package/dist/sync/file-writer.d.ts +2 -1
  131. package/dist/sync/file-writer.js +3 -6
  132. package/dist/sync/index.d.ts +2 -15
  133. package/dist/sync/index.js +0 -19
  134. package/dist/sync/manifest-manager.d.ts +4 -0
  135. package/dist/sync/manifest-manager.js +5 -1
  136. package/dist/sync/manifest.d.ts +10 -41
  137. package/dist/sync/manifest.js +11 -56
  138. package/dist/sync/pr-merge-handler.d.ts +2 -6
  139. package/dist/sync/pr-merge-handler.js +6 -3
  140. package/dist/sync/repository-processor.d.ts +1 -2
  141. package/dist/sync/repository-processor.js +20 -12
  142. package/dist/sync/repository-session.js +5 -14
  143. package/dist/sync/sync-workflow.js +31 -38
  144. package/dist/sync/types.d.ts +43 -178
  145. package/dist/vcs/authenticated-git-ops.d.ts +27 -70
  146. package/dist/vcs/authenticated-git-ops.js +70 -96
  147. package/dist/vcs/azure-pr-strategy.d.ts +6 -4
  148. package/dist/vcs/azure-pr-strategy.js +34 -82
  149. package/dist/vcs/branch-utils.d.ts +6 -0
  150. package/dist/vcs/branch-utils.js +29 -0
  151. package/dist/vcs/commit-strategy-selector.d.ts +5 -0
  152. package/dist/vcs/commit-strategy-selector.js +10 -0
  153. package/dist/vcs/git-commit-strategy.js +1 -2
  154. package/dist/vcs/git-ops.d.ts +15 -59
  155. package/dist/vcs/git-ops.js +46 -110
  156. package/dist/vcs/github-app-token-manager.d.ts +0 -6
  157. package/dist/vcs/github-app-token-manager.js +5 -12
  158. package/dist/vcs/github-pr-strategy.d.ts +5 -5
  159. package/dist/vcs/github-pr-strategy.js +44 -122
  160. package/dist/vcs/gitlab-pr-strategy.d.ts +6 -4
  161. package/dist/vcs/gitlab-pr-strategy.js +39 -87
  162. package/dist/vcs/graphql-commit-strategy.d.ts +3 -4
  163. package/dist/vcs/graphql-commit-strategy.js +31 -63
  164. package/dist/vcs/index.d.ts +3 -16
  165. package/dist/vcs/index.js +2 -33
  166. package/dist/vcs/pr-creator.d.ts +9 -9
  167. package/dist/vcs/pr-creator.js +11 -10
  168. package/dist/vcs/pr-strategy-factory.d.ts +5 -0
  169. package/dist/vcs/pr-strategy-factory.js +17 -0
  170. package/dist/vcs/pr-strategy.d.ts +13 -26
  171. package/dist/vcs/pr-strategy.js +20 -25
  172. package/dist/vcs/types.d.ts +87 -21
  173. package/package.json +2 -1
@@ -1,4 +1,3 @@
1
1
  export { runSync } from "./sync-command.js";
2
- export { program } from "./program.js";
3
- export { type IRepositoryProcessor, type ProcessorFactory, type IRulesetProcessor, type RulesetProcessorFactory, type RepoSettingsProcessorFactory, type IRepoSettingsProcessor, type ILabelsProcessor, type LabelsProcessorFactory, defaultProcessorFactory, defaultRulesetProcessorFactory, defaultRepoSettingsProcessorFactory, defaultLabelsProcessorFactory, } from "./types.js";
2
+ export { type IRepositoryProcessor, type ProcessorFactory, type IRulesetProcessor, type RulesetProcessorFactory, type RepoSettingsProcessorFactory, type ILabelsProcessor, type LabelsProcessorFactory, defaultProcessorFactory, defaultRulesetProcessorFactory, defaultRepoSettingsProcessorFactory, defaultLabelsProcessorFactory, } from "./types.js";
4
3
  export type { SyncOptions, SharedOptions } from "./sync-command.js";
package/dist/cli/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  // CLI command implementations
2
2
  export { runSync } from "./sync-command.js";
3
- export { program } from "./program.js";
4
3
  // Export types - using 'export type' for type aliases, but interfaces need special handling
5
4
  // For ESM compatibility, re-export everything from types.js
6
5
  export {
@@ -3,10 +3,15 @@ import { dirname, join } from "node:path";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
5
5
  import { runSync } from "./sync-command.js";
6
- // Get version from package.json
7
6
  const __filename = fileURLToPath(import.meta.url);
8
7
  const __dirname = dirname(__filename);
9
- const packageJson = JSON.parse(readFileSync(join(__dirname, "../..", "package.json"), "utf-8"));
8
+ let packageJson;
9
+ try {
10
+ packageJson = JSON.parse(readFileSync(join(__dirname, "../..", "package.json"), "utf-8"));
11
+ }
12
+ catch {
13
+ packageJson = { version: "0.0.0" };
14
+ }
10
15
  // =============================================================================
11
16
  // Shared CLI Options
12
17
  // =============================================================================
@@ -1,4 +1,4 @@
1
- import type { ProcessorResults } from "../settings-report-builder.js";
1
+ import type { ProcessorResults } from "./settings-report-builder.js";
2
2
  /**
3
3
  * Collects processing results for the SettingsReport.
4
4
  * Provides a centralized way to track results across rulesets, repo settings, and labels.
@@ -1,3 +1,4 @@
1
+ import { toErrorMessage } from "../shared/type-guards.js";
1
2
  /**
2
3
  * Collects processing results for the SettingsReport.
3
4
  * Provides a centralized way to track results across rulesets, repo settings, and labels.
@@ -14,7 +15,7 @@ export class ResultsCollector {
14
15
  }
15
16
  appendError(repoName, error) {
16
17
  const existing = this.getOrCreate(repoName);
17
- const errorMsg = error instanceof Error ? error.message : String(error);
18
+ const errorMsg = toErrorMessage(error);
18
19
  if (existing.error) {
19
20
  existing.error += `; ${errorMsg}`;
20
21
  }
@@ -1,7 +1,5 @@
1
1
  import type { SettingsReport } from "../output/settings-report.js";
2
- import type { RepoSettingsPlanEntry } from "../settings/repo-settings/formatter.js";
3
- import type { RulesetPlanEntry } from "../settings/rulesets/formatter.js";
4
- import type { LabelsPlanEntry } from "../settings/labels/formatter.js";
2
+ import type { RepoSettingsPlanEntry, RulesetPlanEntry, LabelsPlanEntry } from "../settings/index.js";
5
3
  /**
6
4
  * Result from processing a repository's settings and rulesets.
7
5
  * Used to collect results during settings command execution.
@@ -1,25 +1,3 @@
1
- import { MergeMode, MergeStrategy } from "../config/index.js";
2
- import { type SyncDependencies } from "./types.js";
3
- /**
4
- * Shared options common to all commands.
5
- */
6
- export interface SharedOptions {
7
- config: string;
8
- dryRun?: boolean;
9
- workDir?: string;
10
- retries?: number;
11
- noDelete?: boolean;
12
- }
13
- /**
14
- * Options specific to the sync command.
15
- */
16
- export interface SyncOptions extends SharedOptions {
17
- branch?: string;
18
- merge?: MergeMode;
19
- mergeStrategy?: MergeStrategy;
20
- deleteBranch?: boolean;
21
- }
22
- /**
23
- * Run the sync command - synchronizes files across repositories.
24
- */
1
+ import { type SyncDependencies, type SyncOptions } from "./types.js";
2
+ export type { SharedOptions, SyncOptions } from "./types.js";
25
3
  export declare function runSync(options: SyncOptions, deps?: SyncDependencies): Promise<void>;