@docupace/pipeline 1.0.77 → 1.0.79

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 (69) hide show
  1. package/.prettierrc.cjs +12 -12
  2. package/README.md +135 -135
  3. package/bin/azuread_update_callbacks_for_app.sh +58 -58
  4. package/bin/next-changeset-validate.sh +8 -8
  5. package/bitbucket-pipelines.yml +59 -59
  6. package/eslint.config.js +49 -49
  7. package/jest.config.js +15 -15
  8. package/next/changeset.sh +75 -75
  9. package/next/copy.sh +34 -34
  10. package/next/deploy.sh +40 -40
  11. package/next/execute.sh +123 -123
  12. package/next/sonar.sh +23 -23
  13. package/package.json +1 -1
  14. package/src/auth0/alias.js +79 -79
  15. package/src/auth0/alias.test.js +172 -172
  16. package/src/auth0/cli.js +82 -82
  17. package/src/auth0/configure.js +902 -902
  18. package/src/auth0/configure.test.js +167 -167
  19. package/src/auth0/export.js +48 -48
  20. package/src/auth0/export.test.js +103 -103
  21. package/src/auth0/metadata.js +141 -141
  22. package/src/auth0/metadata.test.js +186 -186
  23. package/src/auth0/vault.js +60 -60
  24. package/src/auth0/vault.test.js +134 -134
  25. package/src/changeset/changelog-wiki.js +328 -328
  26. package/src/changeset/changeset-config.js +34 -34
  27. package/src/changeset/cli.js +237 -237
  28. package/src/changeset/create.js +215 -215
  29. package/src/changeset/package-util.js +87 -87
  30. package/src/changeset/util.js +43 -43
  31. package/src/changeset/validate.js +91 -91
  32. package/src/changeset/version.js +102 -102
  33. package/src/jenkins/setParams.groovy +58 -58
  34. package/src/lib/merge-driver.js +204 -204
  35. package/src/merge/cli-merge-all.js +507 -507
  36. package/src/merge/cli-merge.js +492 -492
  37. package/src/merge/cli-resolve.js +399 -399
  38. package/src/merge/cli.js +38 -38
  39. package/src/merge/merge-changelog.js +87 -87
  40. package/src/merge/merge-package.js +106 -106
  41. package/src/merge/merge-types.js +82 -82
  42. package/src/merge/pr.js +231 -231
  43. package/src/micro/deploy-microservice.js +153 -0
  44. package/src/micro/{ms-publish.js → publish-ms.js} +8 -6
  45. package/src/next/alias.js +53 -53
  46. package/src/next/apache.js +81 -81
  47. package/src/next/cli.js +10 -1
  48. package/src/next/config.js +137 -137
  49. package/src/next/connect.js +226 -226
  50. package/src/next/copy.js +61 -61
  51. package/src/next/deploy.js +666 -633
  52. package/src/next/git-to-semver.js +79 -79
  53. package/src/next/haproxy.js +76 -76
  54. package/src/next/jenkins.js +123 -123
  55. package/src/next/jira.js +84 -84
  56. package/src/next/logger.js +17 -17
  57. package/src/next/pipline.js +114 -114
  58. package/src/next/publish.js +71 -71
  59. package/src/next/pull.js +7 -7
  60. package/src/next/sonar.js +23 -23
  61. package/src/next/test.js +5 -5
  62. package/src/next/util.js +95 -93
  63. package/src/next/vault.js +45 -45
  64. package/terraform/apply.sh +37 -37
  65. package/terraform/init.sh +72 -72
  66. package/terraform/plan.sh +76 -76
  67. package/terraform/validate.sh +17 -17
  68. package/src/micro/cli.js +0 -71
  69. package/src/micro/ms-deploy.js +0 -271
package/src/merge/cli.js CHANGED
@@ -1,38 +1,38 @@
1
- #!/usr/bin/env node
2
- import dotenv from 'dotenv';
3
- dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
4
-
5
- import { Command } from 'commander';
6
- import { setupMerge } from './cli-merge.js';
7
- import { setupResolve } from './cli-resolve.js';
8
- import { setupMergeAll } from './cli-merge-all.js';
9
-
10
- const args = process.argv;
11
- const program = new Command();
12
-
13
- /**
14
- * Reusable auto-resolve function
15
- * @param {Object} options - Options object with config, dryRun, verbose properties
16
- * @returns {Object} - Result object with counts and success status
17
- */
18
-
19
- // Main program
20
- program
21
- .name('merge-cli')
22
- .description(
23
- 'Automatically resolve git merge conflicts based on file patterns',
24
- )
25
- .version('1.0.0');
26
-
27
- // Auto-resolve command (now uses the reusable function)
28
-
29
- setupResolve(program);
30
- setupMerge(program);
31
- setupMergeAll(program);
32
- // Parse command line arguments
33
- program.parse(args);
34
-
35
- // Show help if no arguments provided
36
- if (!args.slice(2).length) {
37
- program.outputHelp();
38
- }
1
+ #!/usr/bin/env node
2
+ import dotenv from 'dotenv';
3
+ dotenv.config({ path: ['.env.pipeline.local', 'config/.env.pipeline.local'] });
4
+
5
+ import { Command } from 'commander';
6
+ import { setupMerge } from './cli-merge.js';
7
+ import { setupResolve } from './cli-resolve.js';
8
+ import { setupMergeAll } from './cli-merge-all.js';
9
+
10
+ const args = process.argv;
11
+ const program = new Command();
12
+
13
+ /**
14
+ * Reusable auto-resolve function
15
+ * @param {Object} options - Options object with config, dryRun, verbose properties
16
+ * @returns {Object} - Result object with counts and success status
17
+ */
18
+
19
+ // Main program
20
+ program
21
+ .name('merge-cli')
22
+ .description(
23
+ 'Automatically resolve git merge conflicts based on file patterns',
24
+ )
25
+ .version('1.0.0');
26
+
27
+ // Auto-resolve command (now uses the reusable function)
28
+
29
+ setupResolve(program);
30
+ setupMerge(program);
31
+ setupMergeAll(program);
32
+ // Parse command line arguments
33
+ program.parse(args);
34
+
35
+ // Show help if no arguments provided
36
+ if (!args.slice(2).length) {
37
+ program.outputHelp();
38
+ }
@@ -1,87 +1,87 @@
1
- import fs from 'fs';
2
- import { execSync } from 'child_process';
3
-
4
- /**
5
- * Simple changelog merger class
6
- */
7
-
8
- class ChangelogMerger {
9
- constructor() {
10
- this.content = '';
11
- }
12
-
13
- /**
14
- * Parse a file with merge conflicts and clean up conflict markers
15
- */
16
- parseConflict(content) {
17
- const lines = content.split('\n');
18
- const cleanedLines = [];
19
-
20
- for (const line of lines) {
21
- if (line.startsWith('<<<<<<<')) {
22
- // Remove conflict start marker
23
- continue;
24
- } else if (line.startsWith('=======')) {
25
- // Replace separator with empty line
26
- cleanedLines.push('');
27
- continue;
28
- } else if (line.startsWith('>>>>>>>')) {
29
- // Remove conflict end marker
30
- continue;
31
- } else {
32
- // Keep all other lines
33
- cleanedLines.push(line);
34
- }
35
- }
36
-
37
- this.content = cleanedLines.join('\n');
38
- }
39
-
40
- /**
41
- * Generate the merged changelog content
42
- */
43
- generateMerged() {
44
- return this.content;
45
- }
46
- }
47
-
48
- /**
49
- * Changelog merge strategy - removes conflict markers and combines content
50
- * @param {string} conflictContent - Content with conflict markers
51
- * @returns {string} - Merged content
52
- */
53
- export function mergeChangelog(conflictContent) {
54
- const merger = new ChangelogMerger();
55
- merger.parseConflict(conflictContent);
56
- return merger.generateMerged();
57
- }
58
-
59
- /**
60
- * Main function for processing a file with merge conflicts
61
- */
62
- export function mergeChangelogFile(filePath) {
63
- try {
64
- // Read the file (which contains the conflict markers)
65
- const fileContent = fs.readFileSync(filePath, 'utf-8');
66
- const result = mergeChangelog(fileContent);
67
-
68
- // Write result back to the same file
69
- fs.writeFileSync(filePath, result);
70
-
71
- // Add file to git staging area to mark as resolved
72
- try {
73
- execSync(`git add ${filePath}`);
74
- console.log('📝 File added to git staging area');
75
- } catch (error) {
76
- console.log(
77
- '⚠️ Could not add file to git (may not be in a git repository)',
78
- );
79
- }
80
-
81
- console.log('Changelog merge completed successfully');
82
- return { success: true };
83
- } catch (error) {
84
- console.error(`Merge failed: ${error.message}`);
85
- throw error;
86
- }
87
- }
1
+ import fs from 'fs';
2
+ import { execSync } from 'child_process';
3
+
4
+ /**
5
+ * Simple changelog merger class
6
+ */
7
+
8
+ class ChangelogMerger {
9
+ constructor() {
10
+ this.content = '';
11
+ }
12
+
13
+ /**
14
+ * Parse a file with merge conflicts and clean up conflict markers
15
+ */
16
+ parseConflict(content) {
17
+ const lines = content.split('\n');
18
+ const cleanedLines = [];
19
+
20
+ for (const line of lines) {
21
+ if (line.startsWith('<<<<<<<')) {
22
+ // Remove conflict start marker
23
+ continue;
24
+ } else if (line.startsWith('=======')) {
25
+ // Replace separator with empty line
26
+ cleanedLines.push('');
27
+ continue;
28
+ } else if (line.startsWith('>>>>>>>')) {
29
+ // Remove conflict end marker
30
+ continue;
31
+ } else {
32
+ // Keep all other lines
33
+ cleanedLines.push(line);
34
+ }
35
+ }
36
+
37
+ this.content = cleanedLines.join('\n');
38
+ }
39
+
40
+ /**
41
+ * Generate the merged changelog content
42
+ */
43
+ generateMerged() {
44
+ return this.content;
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Changelog merge strategy - removes conflict markers and combines content
50
+ * @param {string} conflictContent - Content with conflict markers
51
+ * @returns {string} - Merged content
52
+ */
53
+ export function mergeChangelog(conflictContent) {
54
+ const merger = new ChangelogMerger();
55
+ merger.parseConflict(conflictContent);
56
+ return merger.generateMerged();
57
+ }
58
+
59
+ /**
60
+ * Main function for processing a file with merge conflicts
61
+ */
62
+ export function mergeChangelogFile(filePath) {
63
+ try {
64
+ // Read the file (which contains the conflict markers)
65
+ const fileContent = fs.readFileSync(filePath, 'utf-8');
66
+ const result = mergeChangelog(fileContent);
67
+
68
+ // Write result back to the same file
69
+ fs.writeFileSync(filePath, result);
70
+
71
+ // Add file to git staging area to mark as resolved
72
+ try {
73
+ execSync(`git add ${filePath}`);
74
+ console.log('📝 File added to git staging area');
75
+ } catch (error) {
76
+ console.log(
77
+ '⚠️ Could not add file to git (may not be in a git repository)',
78
+ );
79
+ }
80
+
81
+ console.log('Changelog merge completed successfully');
82
+ return { success: true };
83
+ } catch (error) {
84
+ console.error(`Merge failed: ${error.message}`);
85
+ throw error;
86
+ }
87
+ }
@@ -1,106 +1,106 @@
1
- import fs from 'fs';
2
- import { mergeDriver } from '../lib/merge-driver.js';
3
-
4
- /**
5
- * Custom merge logic for package.json files
6
- * Resolves version conflicts by taking HEAD version
7
- * @param {string} headContent - Content from HEAD (current branch)
8
- * @param {string} branchContent - Content from incoming branch
9
- * @returns {string} - Merged content
10
- * @throws {Error} - If conflicts are not version-only
11
- */
12
- function packageMergeLogic(headContent, branchContent) {
13
- // Check if this is a version-only conflict
14
- if (isVersionOnlyConflict(headContent, branchContent)) {
15
- // Take the HEAD version
16
- return headContent;
17
- } else {
18
- // Throw error to keep the conflict unresolved
19
- throw new Error('Conflict contains more than just version differences');
20
- }
21
- }
22
-
23
- /**
24
- * Check if conflict is version-only
25
- * @param {string} headContent - Content from HEAD
26
- * @param {string} branchContent - Content from branch
27
- * @returns {boolean} - True if only version differs
28
- */
29
- function isVersionOnlyConflict(headContent, branchContent) {
30
- const headVersionMatch = headContent.match(/"version"\s*:\s*"([^"]+)"/);
31
- const branchVersionMatch = branchContent.match(/"version"\s*:\s*"([^"]+)"/);
32
-
33
- if (!headVersionMatch || !branchVersionMatch) {
34
- return false;
35
- }
36
-
37
- // Remove version lines and check if there's any other content
38
- const headWithoutVersion = headContent
39
- .replace(/"version"\s*:\s*"[^"]+",?\s*/g, '')
40
- .trim();
41
- const branchWithoutVersion = branchContent
42
- .replace(/"version"\s*:\s*"[^"]+",?\s*/g, '')
43
- .trim();
44
-
45
- // If both are empty after removing version, it's version-only
46
- // Also handle case where there might be whitespace or comma differences
47
- if (!headWithoutVersion && !branchWithoutVersion) {
48
- return true;
49
- }
50
-
51
- // Additional check: if the only difference is trailing comma or whitespace
52
- const normalizeContent = (content) => {
53
- return content
54
- .replace(/,\s*$/, '') // Remove trailing comma
55
- .replace(/\s+/g, ' ') // Normalize whitespace
56
- .trim();
57
- };
58
-
59
- return (
60
- normalizeContent(headWithoutVersion) ===
61
- normalizeContent(branchWithoutVersion)
62
- );
63
- }
64
-
65
- /**
66
- * Main function to merge package.json conflicts using merge-driver
67
- * @param {string} filePath - Path to package.json file
68
- * @returns {Promise<boolean>} - True if successful
69
- */
70
- export async function mergePackageFile(filePath) {
71
- try {
72
- // Check if file exists
73
- if (!fs.existsSync(filePath)) {
74
- throw new Error(`File not found: ${filePath}`);
75
- }
76
-
77
- console.log(`🔄 Merging package.json conflicts in: ${filePath}`);
78
-
79
- // Use merge driver with custom package.json merge logic
80
- const result = await mergeDriver(filePath, packageMergeLogic);
81
-
82
- // Log results
83
- if (result.success) {
84
- console.log('✅ Package merge completed successfully');
85
- if (result.totalConflicts > 0) {
86
- console.log(
87
- ` Resolved ${result.resolvedConflicts} version-only conflicts`,
88
- );
89
- }
90
- } else {
91
- console.log('⚠️ Package merge partially completed');
92
- console.log(
93
- ` ${result.resolvedConflicts} of ${result.totalConflicts} conflicts resolved`,
94
- );
95
- console.log(' Non-version conflicts require manual resolution');
96
- }
97
-
98
- return result;
99
- } catch (error) {
100
- console.error(`❌ Merge failed: ${error.message}`);
101
- throw error;
102
- }
103
- }
104
-
105
- // Default export
106
- export default mergePackageFile;
1
+ import fs from 'fs';
2
+ import { mergeDriver } from '../lib/merge-driver.js';
3
+
4
+ /**
5
+ * Custom merge logic for package.json files
6
+ * Resolves version conflicts by taking HEAD version
7
+ * @param {string} headContent - Content from HEAD (current branch)
8
+ * @param {string} branchContent - Content from incoming branch
9
+ * @returns {string} - Merged content
10
+ * @throws {Error} - If conflicts are not version-only
11
+ */
12
+ function packageMergeLogic(headContent, branchContent) {
13
+ // Check if this is a version-only conflict
14
+ if (isVersionOnlyConflict(headContent, branchContent)) {
15
+ // Take the HEAD version
16
+ return headContent;
17
+ } else {
18
+ // Throw error to keep the conflict unresolved
19
+ throw new Error('Conflict contains more than just version differences');
20
+ }
21
+ }
22
+
23
+ /**
24
+ * Check if conflict is version-only
25
+ * @param {string} headContent - Content from HEAD
26
+ * @param {string} branchContent - Content from branch
27
+ * @returns {boolean} - True if only version differs
28
+ */
29
+ function isVersionOnlyConflict(headContent, branchContent) {
30
+ const headVersionMatch = headContent.match(/"version"\s*:\s*"([^"]+)"/);
31
+ const branchVersionMatch = branchContent.match(/"version"\s*:\s*"([^"]+)"/);
32
+
33
+ if (!headVersionMatch || !branchVersionMatch) {
34
+ return false;
35
+ }
36
+
37
+ // Remove version lines and check if there's any other content
38
+ const headWithoutVersion = headContent
39
+ .replace(/"version"\s*:\s*"[^"]+",?\s*/g, '')
40
+ .trim();
41
+ const branchWithoutVersion = branchContent
42
+ .replace(/"version"\s*:\s*"[^"]+",?\s*/g, '')
43
+ .trim();
44
+
45
+ // If both are empty after removing version, it's version-only
46
+ // Also handle case where there might be whitespace or comma differences
47
+ if (!headWithoutVersion && !branchWithoutVersion) {
48
+ return true;
49
+ }
50
+
51
+ // Additional check: if the only difference is trailing comma or whitespace
52
+ const normalizeContent = (content) => {
53
+ return content
54
+ .replace(/,\s*$/, '') // Remove trailing comma
55
+ .replace(/\s+/g, ' ') // Normalize whitespace
56
+ .trim();
57
+ };
58
+
59
+ return (
60
+ normalizeContent(headWithoutVersion) ===
61
+ normalizeContent(branchWithoutVersion)
62
+ );
63
+ }
64
+
65
+ /**
66
+ * Main function to merge package.json conflicts using merge-driver
67
+ * @param {string} filePath - Path to package.json file
68
+ * @returns {Promise<boolean>} - True if successful
69
+ */
70
+ export async function mergePackageFile(filePath) {
71
+ try {
72
+ // Check if file exists
73
+ if (!fs.existsSync(filePath)) {
74
+ throw new Error(`File not found: ${filePath}`);
75
+ }
76
+
77
+ console.log(`🔄 Merging package.json conflicts in: ${filePath}`);
78
+
79
+ // Use merge driver with custom package.json merge logic
80
+ const result = await mergeDriver(filePath, packageMergeLogic);
81
+
82
+ // Log results
83
+ if (result.success) {
84
+ console.log('✅ Package merge completed successfully');
85
+ if (result.totalConflicts > 0) {
86
+ console.log(
87
+ ` Resolved ${result.resolvedConflicts} version-only conflicts`,
88
+ );
89
+ }
90
+ } else {
91
+ console.log('⚠️ Package merge partially completed');
92
+ console.log(
93
+ ` ${result.resolvedConflicts} of ${result.totalConflicts} conflicts resolved`,
94
+ );
95
+ console.log(' Non-version conflicts require manual resolution');
96
+ }
97
+
98
+ return result;
99
+ } catch (error) {
100
+ console.error(`❌ Merge failed: ${error.message}`);
101
+ throw error;
102
+ }
103
+ }
104
+
105
+ // Default export
106
+ export default mergePackageFile;
@@ -1,82 +1,82 @@
1
- import { mergeDriver } from '../lib/merge-driver.js';
2
-
3
- /**
4
- * Codegen-specific merge logic for handling balanced braces and removing duplicates
5
- * @param {string} headContent - Content from HEAD (current branch)
6
- * @param {string} branchContent - Content from the incoming branch
7
- * @returns {string} - Merged content
8
- * @throws {Error} - If conflicts cannot be automatically merged
9
- */
10
- function codegenMergeLogic(headContent, branchContent) {
11
- // Check if braces are balanced in both head and branch content
12
- const headOpenBraces = (headContent.match(/\{/g) || []).length;
13
- const headCloseBraces = (headContent.match(/\}/g) || []).length;
14
- const branchOpenBraces = (branchContent.match(/\{/g) || []).length;
15
- const branchCloseBraces = (branchContent.match(/\}/g) || []).length;
16
-
17
- // Check if head content has balanced braces
18
- const headHasBraces = headOpenBraces > 0 || headCloseBraces > 0;
19
- const headBalanced = headOpenBraces === headCloseBraces;
20
-
21
- // Check if branch content has balanced braces
22
- const branchHasBraces = branchOpenBraces > 0 || branchCloseBraces > 0;
23
- const branchBalanced = branchOpenBraces === branchCloseBraces;
24
-
25
- // If either has braces and they're not balanced, we can't merge
26
- if (
27
- (headHasBraces && !headBalanced) ||
28
- (branchHasBraces && !branchBalanced)
29
- ) {
30
- throw new Error('Unbalanced braces detected - cannot merge automatically');
31
- }
32
-
33
- // If both have balanced braces, combine them as-is
34
- if (headHasBraces && branchHasBraces && headBalanced && branchBalanced) {
35
- return headContent + '\n' + branchContent;
36
- }
37
-
38
- // If neither has braces, combine and remove duplicates
39
- if (!headHasBraces && !branchHasBraces) {
40
- const headLines = headContent.split('\n').filter((line) => line);
41
- const branchLines = branchContent.split('\n').filter((line) => line);
42
-
43
- // Use Set to remove duplicates while preserving order
44
- const uniqueLines = [...new Set([...headLines, ...branchLines])];
45
-
46
- return uniqueLines.join('\n');
47
- }
48
-
49
- // Mixed case: one has braces, one doesn't - combine as-is
50
- return headContent + '\n' + branchContent;
51
- }
52
-
53
- /**
54
- * Main function to merge codegen conflicts in a types file
55
- * @param {string} filePath - Path to the file with conflicts
56
- * @returns {Promise<Object>} - Result object with merge details
57
- */
58
- export async function mergeTypesFile(filePath) {
59
- try {
60
- console.log('Starting codegen merge for types file...');
61
-
62
- // Use the merge driver with our custom codegen logic
63
- const result = await mergeDriver(filePath, codegenMergeLogic);
64
-
65
- if (result.success) {
66
- console.log('✅ Codegen merge completed successfully');
67
- } else {
68
- console.log('⚠️ Codegen merge completed with unresolved conflicts');
69
- }
70
-
71
- return result;
72
- } catch (error) {
73
- console.error(`Codegen merge failed: ${error.message}`);
74
- throw error;
75
- }
76
- }
77
-
78
- // Export the merge logic function for direct use if needed
79
- export { codegenMergeLogic };
80
-
81
- // Default export
82
- export default mergeTypesFile;
1
+ import { mergeDriver } from '../lib/merge-driver.js';
2
+
3
+ /**
4
+ * Codegen-specific merge logic for handling balanced braces and removing duplicates
5
+ * @param {string} headContent - Content from HEAD (current branch)
6
+ * @param {string} branchContent - Content from the incoming branch
7
+ * @returns {string} - Merged content
8
+ * @throws {Error} - If conflicts cannot be automatically merged
9
+ */
10
+ function codegenMergeLogic(headContent, branchContent) {
11
+ // Check if braces are balanced in both head and branch content
12
+ const headOpenBraces = (headContent.match(/\{/g) || []).length;
13
+ const headCloseBraces = (headContent.match(/\}/g) || []).length;
14
+ const branchOpenBraces = (branchContent.match(/\{/g) || []).length;
15
+ const branchCloseBraces = (branchContent.match(/\}/g) || []).length;
16
+
17
+ // Check if head content has balanced braces
18
+ const headHasBraces = headOpenBraces > 0 || headCloseBraces > 0;
19
+ const headBalanced = headOpenBraces === headCloseBraces;
20
+
21
+ // Check if branch content has balanced braces
22
+ const branchHasBraces = branchOpenBraces > 0 || branchCloseBraces > 0;
23
+ const branchBalanced = branchOpenBraces === branchCloseBraces;
24
+
25
+ // If either has braces and they're not balanced, we can't merge
26
+ if (
27
+ (headHasBraces && !headBalanced) ||
28
+ (branchHasBraces && !branchBalanced)
29
+ ) {
30
+ throw new Error('Unbalanced braces detected - cannot merge automatically');
31
+ }
32
+
33
+ // If both have balanced braces, combine them as-is
34
+ if (headHasBraces && branchHasBraces && headBalanced && branchBalanced) {
35
+ return headContent + '\n' + branchContent;
36
+ }
37
+
38
+ // If neither has braces, combine and remove duplicates
39
+ if (!headHasBraces && !branchHasBraces) {
40
+ const headLines = headContent.split('\n').filter((line) => line);
41
+ const branchLines = branchContent.split('\n').filter((line) => line);
42
+
43
+ // Use Set to remove duplicates while preserving order
44
+ const uniqueLines = [...new Set([...headLines, ...branchLines])];
45
+
46
+ return uniqueLines.join('\n');
47
+ }
48
+
49
+ // Mixed case: one has braces, one doesn't - combine as-is
50
+ return headContent + '\n' + branchContent;
51
+ }
52
+
53
+ /**
54
+ * Main function to merge codegen conflicts in a types file
55
+ * @param {string} filePath - Path to the file with conflicts
56
+ * @returns {Promise<Object>} - Result object with merge details
57
+ */
58
+ export async function mergeTypesFile(filePath) {
59
+ try {
60
+ console.log('Starting codegen merge for types file...');
61
+
62
+ // Use the merge driver with our custom codegen logic
63
+ const result = await mergeDriver(filePath, codegenMergeLogic);
64
+
65
+ if (result.success) {
66
+ console.log('✅ Codegen merge completed successfully');
67
+ } else {
68
+ console.log('⚠️ Codegen merge completed with unresolved conflicts');
69
+ }
70
+
71
+ return result;
72
+ } catch (error) {
73
+ console.error(`Codegen merge failed: ${error.message}`);
74
+ throw error;
75
+ }
76
+ }
77
+
78
+ // Export the merge logic function for direct use if needed
79
+ export { codegenMergeLogic };
80
+
81
+ // Default export
82
+ export default mergeTypesFile;