@muverse/core 0.1.0

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 (117) hide show
  1. package/README.md +22 -0
  2. package/dist/adapters/gradle/constants.d.ts +13 -0
  3. package/dist/adapters/gradle/constants.d.ts.map +1 -0
  4. package/dist/adapters/gradle/constants.js +12 -0
  5. package/dist/adapters/gradle/gradle-project-information.d.ts +18 -0
  6. package/dist/adapters/gradle/gradle-project-information.d.ts.map +1 -0
  7. package/dist/adapters/gradle/gradle-project-information.js +93 -0
  8. package/dist/adapters/gradle/gradle-properties.d.ts +15 -0
  9. package/dist/adapters/gradle/gradle-properties.d.ts.map +1 -0
  10. package/dist/adapters/gradle/gradle-properties.js +46 -0
  11. package/dist/adapters/gradle/init-project-information.gradle.kts +143 -0
  12. package/dist/adapters/gradle/services/gradle-adapter-identifier.d.ts +21 -0
  13. package/dist/adapters/gradle/services/gradle-adapter-identifier.d.ts.map +1 -0
  14. package/dist/adapters/gradle/services/gradle-adapter-identifier.js +44 -0
  15. package/dist/adapters/gradle/services/gradle-module-detector.d.ts +18 -0
  16. package/dist/adapters/gradle/services/gradle-module-detector.d.ts.map +1 -0
  17. package/dist/adapters/gradle/services/gradle-module-detector.js +26 -0
  18. package/dist/adapters/gradle/services/gradle-module-system-factory.d.ts +23 -0
  19. package/dist/adapters/gradle/services/gradle-module-system-factory.d.ts.map +1 -0
  20. package/dist/adapters/gradle/services/gradle-module-system-factory.js +27 -0
  21. package/dist/adapters/gradle/services/gradle-version-update-strategy.d.ts +21 -0
  22. package/dist/adapters/gradle/services/gradle-version-update-strategy.d.ts.map +1 -0
  23. package/dist/adapters/gradle/services/gradle-version-update-strategy.js +36 -0
  24. package/dist/adapters/project-information.d.ts +58 -0
  25. package/dist/adapters/project-information.d.ts.map +1 -0
  26. package/dist/adapters/project-information.js +1 -0
  27. package/dist/changelog/index.d.ts +27 -0
  28. package/dist/changelog/index.d.ts.map +1 -0
  29. package/dist/changelog/index.js +204 -0
  30. package/dist/config/index.d.ts +122 -0
  31. package/dist/config/index.d.ts.map +1 -0
  32. package/dist/config/index.js +115 -0
  33. package/dist/factories/adapter-identifier-registry.d.ts +12 -0
  34. package/dist/factories/adapter-identifier-registry.d.ts.map +1 -0
  35. package/dist/factories/adapter-identifier-registry.js +24 -0
  36. package/dist/factories/module-system-factory.d.ts +10 -0
  37. package/dist/factories/module-system-factory.d.ts.map +1 -0
  38. package/dist/factories/module-system-factory.js +18 -0
  39. package/dist/git/index.d.ts +253 -0
  40. package/dist/git/index.d.ts.map +1 -0
  41. package/dist/git/index.js +581 -0
  42. package/dist/index.d.ts +23 -0
  43. package/dist/index.d.ts.map +1 -0
  44. package/dist/index.js +22 -0
  45. package/dist/semver/index.d.ts +85 -0
  46. package/dist/semver/index.d.ts.map +1 -0
  47. package/dist/semver/index.js +176 -0
  48. package/dist/services/adapter-identifier-registry.d.ts +38 -0
  49. package/dist/services/adapter-identifier-registry.d.ts.map +1 -0
  50. package/dist/services/adapter-identifier-registry.js +59 -0
  51. package/dist/services/adapter-identifier.d.ts +31 -0
  52. package/dist/services/adapter-identifier.d.ts.map +1 -0
  53. package/dist/services/adapter-identifier.js +1 -0
  54. package/dist/services/adapter-metadata-provider.d.ts +51 -0
  55. package/dist/services/adapter-metadata-provider.d.ts.map +1 -0
  56. package/dist/services/adapter-metadata-provider.js +66 -0
  57. package/dist/services/changelog-generator.d.ts +13 -0
  58. package/dist/services/changelog-generator.d.ts.map +1 -0
  59. package/dist/services/changelog-generator.js +26 -0
  60. package/dist/services/commit-analyzer.d.ts +44 -0
  61. package/dist/services/commit-analyzer.d.ts.map +1 -0
  62. package/dist/services/commit-analyzer.js +86 -0
  63. package/dist/services/configuration-loader.d.ts +23 -0
  64. package/dist/services/configuration-loader.d.ts.map +1 -0
  65. package/dist/services/configuration-loader.js +79 -0
  66. package/dist/services/configuration-validator.d.ts +16 -0
  67. package/dist/services/configuration-validator.d.ts.map +1 -0
  68. package/dist/services/configuration-validator.js +24 -0
  69. package/dist/services/git-operations.d.ts +16 -0
  70. package/dist/services/git-operations.d.ts.map +1 -0
  71. package/dist/services/git-operations.js +89 -0
  72. package/dist/services/module-detector.d.ts +24 -0
  73. package/dist/services/module-detector.d.ts.map +1 -0
  74. package/dist/services/module-detector.js +1 -0
  75. package/dist/services/module-registry.d.ts +45 -0
  76. package/dist/services/module-registry.d.ts.map +1 -0
  77. package/dist/services/module-registry.js +57 -0
  78. package/dist/services/module-system-factory.d.ts +24 -0
  79. package/dist/services/module-system-factory.d.ts.map +1 -0
  80. package/dist/services/module-system-factory.js +1 -0
  81. package/dist/services/verse-runner.d.ts +45 -0
  82. package/dist/services/verse-runner.d.ts.map +1 -0
  83. package/dist/services/verse-runner.js +182 -0
  84. package/dist/services/version-applier.d.ts +26 -0
  85. package/dist/services/version-applier.d.ts.map +1 -0
  86. package/dist/services/version-applier.js +63 -0
  87. package/dist/services/version-bumper.d.ts +156 -0
  88. package/dist/services/version-bumper.d.ts.map +1 -0
  89. package/dist/services/version-bumper.js +291 -0
  90. package/dist/services/version-manager.d.ts +68 -0
  91. package/dist/services/version-manager.d.ts.map +1 -0
  92. package/dist/services/version-manager.js +94 -0
  93. package/dist/services/version-update-strategy.d.ts +18 -0
  94. package/dist/services/version-update-strategy.d.ts.map +1 -0
  95. package/dist/services/version-update-strategy.js +1 -0
  96. package/dist/utils/banner.d.ts +2 -0
  97. package/dist/utils/banner.d.ts.map +1 -0
  98. package/dist/utils/banner.js +8 -0
  99. package/dist/utils/commits.d.ts +12 -0
  100. package/dist/utils/commits.d.ts.map +1 -0
  101. package/dist/utils/commits.js +24 -0
  102. package/dist/utils/file.d.ts +7 -0
  103. package/dist/utils/file.d.ts.map +1 -0
  104. package/dist/utils/file.js +19 -0
  105. package/dist/utils/index.d.ts +6 -0
  106. package/dist/utils/index.d.ts.map +1 -0
  107. package/dist/utils/index.js +5 -0
  108. package/dist/utils/logger.d.ts +14 -0
  109. package/dist/utils/logger.d.ts.map +1 -0
  110. package/dist/utils/logger.js +22 -0
  111. package/dist/utils/properties.d.ts +16 -0
  112. package/dist/utils/properties.d.ts.map +1 -0
  113. package/dist/utils/properties.js +62 -0
  114. package/dist/utils/versioning.d.ts +8 -0
  115. package/dist/utils/versioning.d.ts.map +1 -0
  116. package/dist/utils/versioning.js +17 -0
  117. package/package.json +70 -0
@@ -0,0 +1,85 @@
1
+ import { SemVer } from "semver";
2
+ /**
3
+ * Semantic version bump types: major, minor, patch, or none.
4
+ * Represents different ways a version can be incremented per Semantic Versioning 2.0.0.
5
+ */
6
+ export type BumpType = "major" | "minor" | "patch" | "none";
7
+ /**
8
+ * Parses a semantic version string into a SemVer object.
9
+ * @param versionString - The version string to parse (e.g., '1.2.3', '2.0.0-beta.1')
10
+ * @returns A parsed SemVer object with structured version components
11
+ * @throws {Error} If the version string is invalid or cannot be parsed
12
+ */
13
+ export declare function parseSemVer(versionString: string): SemVer;
14
+ /**
15
+ * Converts a SemVer object to its string representation.
16
+ * @param version - The SemVer object to format
17
+ * @returns The version as a string, preserving all components including build metadata
18
+ */
19
+ export declare function formatSemVer(version: SemVer): string;
20
+ /**
21
+ * Compares two semantic versions following SemVer precedence rules.
22
+ * @param a - The first version to compare
23
+ * @param b - The second version to compare
24
+ * @returns `-1` if a < b, `0` if a === b, `1` if a > b
25
+ */
26
+ export declare function compareSemVer(a: SemVer, b: SemVer): number;
27
+ /**
28
+ * Increments a semantic version based on the specified bump type.
29
+ * @param version - The version to bump
30
+ * @param bumpType - The type of version increment to apply
31
+ * @returns A new SemVer object with the incremented version
32
+ * @throws {Error} If the version cannot be bumped with the specified type
33
+ */
34
+ export declare function bumpSemVer(version: SemVer, bumpType: BumpType): SemVer;
35
+ /**
36
+ * Determines the bump type between two versions.
37
+ * @param from - The starting version
38
+ * @param to - The ending version
39
+ * @returns The bump type that would transform 'from' into 'to'
40
+ */
41
+ export declare function getBumpType(from: SemVer, to: SemVer): BumpType;
42
+ /**
43
+ * Determines the highest priority bump type from an array.
44
+ * Priority: major > minor > patch > none.
45
+ * @param bumpTypes - Array of bump types to evaluate
46
+ * @returns The bump type with highest priority
47
+ */
48
+ export declare function maxBumpType(bumpTypes: BumpType[]): BumpType;
49
+ /**
50
+ * Validates whether a string is a valid semantic version.
51
+ * @param versionString - The version string to validate
52
+ * @returns True if valid semantic version, false otherwise
53
+ */
54
+ export declare function isValidVersionString(versionString: string): boolean;
55
+ /**
56
+ * Creates an initial semantic version (0.0.0) for new modules or projects.
57
+ * @returns A SemVer object representing version 0.0.0
58
+ */
59
+ export declare function createInitialVersion(): SemVer;
60
+ /**
61
+ * Bumps a version to a prerelease version.
62
+ * @param version - The version to bump to prerelease
63
+ * @param bumpType - The type of version bump to apply before adding prerelease identifier
64
+ * @param prereleaseId - The prerelease identifier (e.g., 'alpha', 'beta', 'rc')
65
+ * @returns A new SemVer object with the prerelease version
66
+ * @throws {Error} If the bump operation fails
67
+ */
68
+ export declare function bumpToPrerelease(version: SemVer, bumpType: BumpType, prereleaseId: string): SemVer;
69
+ /**
70
+ * Adds build metadata to a semantic version.
71
+ * Build metadata is appended with a '+' sign and doesn't affect version precedence.
72
+ * @param version - The version to add metadata to
73
+ * @param buildMetadata - The build metadata string to append
74
+ * @returns A new SemVer object with the build metadata appended
75
+ */
76
+ export declare function addBuildMetadata(version: SemVer, buildMetadata: string): SemVer;
77
+ /**
78
+ * Generates a timestamp-based prerelease identifier in format `{baseId}.{YYYYMMDD}.{HHMM}`.
79
+ * Creates unique, sortable prerelease identifiers using UTC timestamps.
80
+ * @param baseId - The base identifier for the prerelease (e.g., 'alpha', 'beta', 'rc')
81
+ * @param timestamp - Optional timestamp to use; defaults to current date/time
82
+ * @returns A prerelease identifier string (e.g., 'alpha.20230515.1430')
83
+ */
84
+ export declare function generateTimestampPrereleaseId(baseId: string, timestamp?: Date): string;
85
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/semver/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;AAE5D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAQzD;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAatE;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,QAAQ,CAc9D;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAM3D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAEnE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,MAAM,GACnB,MAAM,CAkDR;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB,MAAM,CAMR;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,SAAS,CAAC,EAAE,IAAI,GACf,MAAM,CAeR"}
@@ -0,0 +1,176 @@
1
+ import * as semver from "semver";
2
+ import { SemVer } from "semver";
3
+ /**
4
+ * Parses a semantic version string into a SemVer object.
5
+ * @param versionString - The version string to parse (e.g., '1.2.3', '2.0.0-beta.1')
6
+ * @returns A parsed SemVer object with structured version components
7
+ * @throws {Error} If the version string is invalid or cannot be parsed
8
+ */
9
+ export function parseSemVer(versionString) {
10
+ const parsed = semver.parse(versionString);
11
+ if (!parsed) {
12
+ throw new Error(`Invalid semantic version: ${versionString}`);
13
+ }
14
+ return parsed;
15
+ }
16
+ /**
17
+ * Converts a SemVer object to its string representation.
18
+ * @param version - The SemVer object to format
19
+ * @returns The version as a string, preserving all components including build metadata
20
+ */
21
+ export function formatSemVer(version) {
22
+ return version.raw;
23
+ }
24
+ /**
25
+ * Compares two semantic versions following SemVer precedence rules.
26
+ * @param a - The first version to compare
27
+ * @param b - The second version to compare
28
+ * @returns `-1` if a < b, `0` if a === b, `1` if a > b
29
+ */
30
+ export function compareSemVer(a, b) {
31
+ return semver.compare(a, b);
32
+ }
33
+ /**
34
+ * Increments a semantic version based on the specified bump type.
35
+ * @param version - The version to bump
36
+ * @param bumpType - The type of version increment to apply
37
+ * @returns A new SemVer object with the incremented version
38
+ * @throws {Error} If the version cannot be bumped with the specified type
39
+ */
40
+ export function bumpSemVer(version, bumpType) {
41
+ if (bumpType === "none") {
42
+ return version;
43
+ }
44
+ const bumpedVersionString = semver.inc(version, bumpType);
45
+ if (!bumpedVersionString) {
46
+ throw new Error(`Failed to bump version ${version.version} with type ${bumpType}`);
47
+ }
48
+ return parseSemVer(bumpedVersionString);
49
+ }
50
+ /**
51
+ * Determines the bump type between two versions.
52
+ * @param from - The starting version
53
+ * @param to - The ending version
54
+ * @returns The bump type that would transform 'from' into 'to'
55
+ */
56
+ export function getBumpType(from, to) {
57
+ if (to.major > from.major) {
58
+ return "major";
59
+ }
60
+ if (to.minor > from.minor) {
61
+ return "minor";
62
+ }
63
+ if (to.patch > from.patch) {
64
+ return "patch";
65
+ }
66
+ return "none";
67
+ }
68
+ /**
69
+ * Determines the highest priority bump type from an array.
70
+ * Priority: major > minor > patch > none.
71
+ * @param bumpTypes - Array of bump types to evaluate
72
+ * @returns The bump type with highest priority
73
+ */
74
+ export function maxBumpType(bumpTypes) {
75
+ const priority = { none: 0, patch: 1, minor: 2, major: 3 };
76
+ return bumpTypes.reduce((max, current) => {
77
+ return priority[current] > priority[max] ? current : max;
78
+ }, "none");
79
+ }
80
+ /**
81
+ * Validates whether a string is a valid semantic version.
82
+ * @param versionString - The version string to validate
83
+ * @returns True if valid semantic version, false otherwise
84
+ */
85
+ export function isValidVersionString(versionString) {
86
+ return semver.valid(versionString) !== null;
87
+ }
88
+ /**
89
+ * Creates an initial semantic version (0.0.0) for new modules or projects.
90
+ * @returns A SemVer object representing version 0.0.0
91
+ */
92
+ export function createInitialVersion() {
93
+ return new SemVer("0.0.0");
94
+ }
95
+ /**
96
+ * Bumps a version to a prerelease version.
97
+ * @param version - The version to bump to prerelease
98
+ * @param bumpType - The type of version bump to apply before adding prerelease identifier
99
+ * @param prereleaseId - The prerelease identifier (e.g., 'alpha', 'beta', 'rc')
100
+ * @returns A new SemVer object with the prerelease version
101
+ * @throws {Error} If the bump operation fails
102
+ */
103
+ export function bumpToPrerelease(version, bumpType, prereleaseId) {
104
+ if (bumpType === "none") {
105
+ // If no changes, convert current version to prerelease
106
+ if (version.prerelease.length > 0) {
107
+ // Already a prerelease, increment the prerelease version
108
+ const bumpedVersionString = semver.inc(version, "prerelease", prereleaseId);
109
+ if (!bumpedVersionString) {
110
+ throw new Error(`Failed to bump prerelease version ${version.version}`);
111
+ }
112
+ return parseSemVer(bumpedVersionString);
113
+ }
114
+ else {
115
+ // Convert to prerelease by bumping patch and adding prerelease identifier
116
+ const bumpedVersionString = semver.inc(version, "prepatch", prereleaseId);
117
+ if (!bumpedVersionString) {
118
+ throw new Error(`Failed to create prerelease version from ${version.version}`);
119
+ }
120
+ return parseSemVer(bumpedVersionString);
121
+ }
122
+ }
123
+ // Bump to prerelease version based on bump type
124
+ let prereleaseType;
125
+ switch (bumpType) {
126
+ case "patch":
127
+ prereleaseType = "prepatch";
128
+ break;
129
+ case "minor":
130
+ prereleaseType = "preminor";
131
+ break;
132
+ case "major":
133
+ prereleaseType = "premajor";
134
+ break;
135
+ default:
136
+ throw new Error(`Invalid bump type for prerelease: ${bumpType}`);
137
+ }
138
+ const bumpedVersionString = semver.inc(version, prereleaseType, prereleaseId);
139
+ if (!bumpedVersionString) {
140
+ throw new Error(`Failed to bump version ${version.version} to prerelease with type ${prereleaseType}`);
141
+ }
142
+ return parseSemVer(bumpedVersionString);
143
+ }
144
+ /**
145
+ * Adds build metadata to a semantic version.
146
+ * Build metadata is appended with a '+' sign and doesn't affect version precedence.
147
+ * @param version - The version to add metadata to
148
+ * @param buildMetadata - The build metadata string to append
149
+ * @returns A new SemVer object with the build metadata appended
150
+ */
151
+ export function addBuildMetadata(version, buildMetadata) {
152
+ // Use the existing version string and append build metadata
153
+ const baseVersionString = version.format(); // Gets version without build metadata
154
+ const newVersionString = `${baseVersionString}+${buildMetadata}`;
155
+ return parseSemVer(newVersionString);
156
+ }
157
+ /**
158
+ * Generates a timestamp-based prerelease identifier in format `{baseId}.{YYYYMMDD}.{HHMM}`.
159
+ * Creates unique, sortable prerelease identifiers using UTC timestamps.
160
+ * @param baseId - The base identifier for the prerelease (e.g., 'alpha', 'beta', 'rc')
161
+ * @param timestamp - Optional timestamp to use; defaults to current date/time
162
+ * @returns A prerelease identifier string (e.g., 'alpha.20230515.1430')
163
+ */
164
+ export function generateTimestampPrereleaseId(baseId, timestamp) {
165
+ const date = timestamp || new Date();
166
+ // Format: YYYYMMDD (using UTC to ensure consistency across timezones)
167
+ const year = date.getUTCFullYear();
168
+ const month = String(date.getUTCMonth() + 1).padStart(2, "0");
169
+ const day = String(date.getUTCDate()).padStart(2, "0");
170
+ const dateString = `${year}${month}${day}`;
171
+ // Format: HHMM (using UTC to ensure consistency across timezones)
172
+ const hours = String(date.getUTCHours()).padStart(2, "0");
173
+ const minutes = String(date.getUTCMinutes()).padStart(2, "0");
174
+ const timeString = `${hours}${minutes}`;
175
+ return `${baseId}.${dateString}.${timeString}`;
176
+ }
@@ -0,0 +1,38 @@
1
+ import { AdapterIdentifier } from "./adapter-identifier.js";
2
+ /**
3
+ * Registry for managing and discovering adapter identifiers.
4
+ * Provides automatic project adapter detection, fast lookup by ID, and discovery of supported adapters.
5
+ */
6
+ export declare class AdapterIdentifierRegistry {
7
+ /**
8
+ * Internal map of adapter identifiers keyed by their unique ID.
9
+ */
10
+ private readonly identifiers;
11
+ /**
12
+ * Cached array of all supported adapter IDs.
13
+ */
14
+ private readonly supportedAdapters;
15
+ /**
16
+ * Creates a new adapter identifier registry.
17
+ * @param identifiers - Array of adapter identifiers to register
18
+ */
19
+ constructor(identifiers: AdapterIdentifier[]);
20
+ /**
21
+ * Automatically identifies which adapter can handle the specified project.
22
+ * @param projectRoot - The absolute path to the root directory of the project to analyze
23
+ * @returns A promise that resolves to the first matching adapter, or `null` if no adapter can handle the project
24
+ */
25
+ identify(projectRoot: string): Promise<AdapterIdentifier | null>;
26
+ /**
27
+ * Retrieves a specific adapter identifier by its unique ID.
28
+ * @param id - The unique identifier of the adapter to retrieve
29
+ * @returns The adapter if found, or `null` if not registered
30
+ */
31
+ getIdentifierById(id: string): AdapterIdentifier | null;
32
+ /**
33
+ * Returns a list of all supported adapter IDs in this registry.
34
+ * @returns An array of adapter ID strings
35
+ */
36
+ getSupportedAdapters(): string[];
37
+ }
38
+ //# sourceMappingURL=adapter-identifier-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-identifier-registry.d.ts","sourceRoot":"","sources":["../../src/services/adapter-identifier-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;;GAGG;AACH,qBAAa,yBAAyB;IACpC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyC;IAErE;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAW;IAE7C;;;OAGG;gBACS,WAAW,EAAE,iBAAiB,EAAE;IAK5C;;;;OAIG;IACG,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC;IAkBtE;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI;IAIvD;;;OAGG;IACH,oBAAoB,IAAI,MAAM,EAAE;CAGjC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Registry for managing and discovering adapter identifiers.
3
+ * Provides automatic project adapter detection, fast lookup by ID, and discovery of supported adapters.
4
+ */
5
+ export class AdapterIdentifierRegistry {
6
+ /**
7
+ * Internal map of adapter identifiers keyed by their unique ID.
8
+ */
9
+ identifiers;
10
+ /**
11
+ * Cached array of all supported adapter IDs.
12
+ */
13
+ supportedAdapters;
14
+ /**
15
+ * Creates a new adapter identifier registry.
16
+ * @param identifiers - Array of adapter identifiers to register
17
+ */
18
+ constructor(identifiers) {
19
+ this.identifiers = new Map(identifiers.map((id) => [id.metadata.id, id]));
20
+ this.supportedAdapters = Array.from(this.identifiers.keys());
21
+ }
22
+ /**
23
+ * Automatically identifies which adapter can handle the specified project.
24
+ * @param projectRoot - The absolute path to the root directory of the project to analyze
25
+ * @returns A promise that resolves to the first matching adapter, or `null` if no adapter can handle the project
26
+ */
27
+ async identify(projectRoot) {
28
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
29
+ for (const [_, identifier] of this.identifiers) {
30
+ try {
31
+ const result = await identifier.accept(projectRoot);
32
+ if (result) {
33
+ return identifier;
34
+ }
35
+ }
36
+ catch (error) {
37
+ // Continue to the next identifier if this one fails
38
+ // This ensures robustness - one faulty adapter won't break discovery
39
+ continue;
40
+ }
41
+ }
42
+ return null;
43
+ }
44
+ /**
45
+ * Retrieves a specific adapter identifier by its unique ID.
46
+ * @param id - The unique identifier of the adapter to retrieve
47
+ * @returns The adapter if found, or `null` if not registered
48
+ */
49
+ getIdentifierById(id) {
50
+ return this.identifiers.get(id) || null;
51
+ }
52
+ /**
53
+ * Returns a list of all supported adapter IDs in this registry.
54
+ * @returns An array of adapter ID strings
55
+ */
56
+ getSupportedAdapters() {
57
+ return this.supportedAdapters;
58
+ }
59
+ }
@@ -0,0 +1,31 @@
1
+ /** Metadata describing an adapter's identity and capabilities. */
2
+ export type AdapterMetadata = {
3
+ /** Unique identifier (e.g., 'gradle', 'maven', 'npm'). */
4
+ readonly id: string;
5
+ /** Features supported by this adapter. */
6
+ readonly capabilities: AdapterCapabilities;
7
+ };
8
+ /** Feature capabilities of an adapter. */
9
+ export type AdapterCapabilities = {
10
+ /** Whether the adapter supports snapshot versions (e.g., '1.0.0-SNAPSHOT'). */
11
+ readonly supportsSnapshots: boolean;
12
+ };
13
+ /**
14
+ * Interface for adapter identification and auto-discovery.
15
+ *
16
+ * @remarks
17
+ * Implementations identify which adapter can handle a project by checking for
18
+ * build-system-specific files (e.g., build.gradle, pom.xml, package.json).
19
+ */
20
+ export interface AdapterIdentifier {
21
+ /** Adapter metadata with ID and capabilities. */
22
+ readonly metadata: AdapterMetadata;
23
+ /**
24
+ * Determines whether this adapter can handle the specified project.
25
+ *
26
+ * @param projectRoot - Absolute path to project root
27
+ * @returns `true` if adapter can handle the project, `false` otherwise
28
+ */
29
+ accept(projectRoot: string): Promise<boolean>;
30
+ }
31
+ //# sourceMappingURL=adapter-identifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-identifier.d.ts","sourceRoot":"","sources":["../../src/services/adapter-identifier.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,MAAM,eAAe,GAAG;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IAEpB,0CAA0C;IAC1C,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAC;CAC5C,CAAC;AAEF,0CAA0C;AAC1C,MAAM,MAAM,mBAAmB,GAAG;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC;;;;;OAKG;IACH,MAAM,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC/C"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,51 @@
1
+ import { AdapterMetadata } from "./adapter-identifier.js";
2
+ import { AdapterIdentifierRegistry } from "./adapter-identifier-registry.js";
3
+ /**
4
+ * Configuration options for the adapter metadata provider.
5
+ */
6
+ export type AdapterMetadataProviderOptions = {
7
+ /**
8
+ * Optional explicit adapter identifier. When provided, overrides auto-detection.
9
+ */
10
+ adapter?: string;
11
+ /**
12
+ * The absolute path to the repository root directory.
13
+ */
14
+ repoRoot: string;
15
+ };
16
+ /**
17
+ * Provides adapter metadata with support for explicit specification and auto-detection.
18
+ */
19
+ export declare class AdapterMetadataProvider {
20
+ private readonly adapterIdentifierRegistry;
21
+ private readonly options;
22
+ /**
23
+ * The normalized adapter ID from options, if provided.
24
+ */
25
+ private readonly adapterId;
26
+ /**
27
+ * Creates a new adapter metadata provider.
28
+ * @param adapterIdentifierRegistry - The registry containing all available adapter identifiers
29
+ * @param options - Configuration options for adapter resolution
30
+ */
31
+ constructor(adapterIdentifierRegistry: AdapterIdentifierRegistry, options: AdapterMetadataProviderOptions);
32
+ /**
33
+ * Retrieves the metadata for the resolved adapter.
34
+ * @returns A promise that resolves to the adapter metadata
35
+ * @throws {Error} If the specified adapter is not supported or no adapter can be auto-detected
36
+ */
37
+ getMetadata(): Promise<AdapterMetadata>;
38
+ /**
39
+ * Attempts to retrieve the explicitly specified adapter.
40
+ * @returns A promise that resolves to the adapter if specified and found, or `null` if not specified
41
+ * @throws {Error} If an adapter was specified but is not registered in the registry
42
+ */
43
+ private getSpecifiedAdapter;
44
+ /**
45
+ * Attempts to automatically detect the appropriate adapter for the project.
46
+ * @returns A promise that resolves to the auto-detected adapter
47
+ * @throws {Error} If no adapter could be detected for the project
48
+ */
49
+ private getAutoDetectedAdapter;
50
+ }
51
+ //# sourceMappingURL=adapter-metadata-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-metadata-provider.d.ts","sourceRoot":"","sources":["../../src/services/adapter-metadata-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAqB,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE7E;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,qBAAa,uBAAuB;IAYhC,OAAO,CAAC,QAAQ,CAAC,yBAAyB;IAC1C,OAAO,CAAC,QAAQ,CAAC,OAAO;IAZ1B;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;IAE/C;;;;OAIG;gBAEgB,yBAAyB,EAAE,yBAAyB,EACpD,OAAO,EAAE,8BAA8B;IAK1D;;;;OAIG;IACG,WAAW,IAAI,OAAO,CAAC,eAAe,CAAC;IAQ7C;;;;OAIG;YACW,mBAAmB;IAoBjC;;;;OAIG;YACW,sBAAsB;CAiBrC"}
@@ -0,0 +1,66 @@
1
+ import { logger } from "../utils/logger.js";
2
+ /**
3
+ * Provides adapter metadata with support for explicit specification and auto-detection.
4
+ */
5
+ export class AdapterMetadataProvider {
6
+ adapterIdentifierRegistry;
7
+ options;
8
+ /**
9
+ * The normalized adapter ID from options, if provided.
10
+ */
11
+ adapterId;
12
+ /**
13
+ * Creates a new adapter metadata provider.
14
+ * @param adapterIdentifierRegistry - The registry containing all available adapter identifiers
15
+ * @param options - Configuration options for adapter resolution
16
+ */
17
+ constructor(adapterIdentifierRegistry, options) {
18
+ this.adapterIdentifierRegistry = adapterIdentifierRegistry;
19
+ this.options = options;
20
+ this.adapterId = options.adapter?.toLowerCase();
21
+ }
22
+ /**
23
+ * Retrieves the metadata for the resolved adapter.
24
+ * @returns A promise that resolves to the adapter metadata
25
+ * @throws {Error} If the specified adapter is not supported or no adapter can be auto-detected
26
+ */
27
+ async getMetadata() {
28
+ let identifier = await this.getSpecifiedAdapter();
29
+ if (!identifier) {
30
+ identifier = await this.getAutoDetectedAdapter();
31
+ }
32
+ return identifier.metadata;
33
+ }
34
+ /**
35
+ * Attempts to retrieve the explicitly specified adapter.
36
+ * @returns A promise that resolves to the adapter if specified and found, or `null` if not specified
37
+ * @throws {Error} If an adapter was specified but is not registered in the registry
38
+ */
39
+ async getSpecifiedAdapter() {
40
+ if (!this.adapterId)
41
+ return null;
42
+ const identifier = this.adapterIdentifierRegistry.getIdentifierById(this.adapterId);
43
+ if (!identifier) {
44
+ throw new Error(`Unsupported adapter '${this.adapterId}'. Supported adapters: ${this.adapterIdentifierRegistry
45
+ .getSupportedAdapters()
46
+ .join(", ")}`);
47
+ }
48
+ logger.info(`📝 Using explicitly provided adapter: ${this.adapterId}`);
49
+ return identifier;
50
+ }
51
+ /**
52
+ * Attempts to automatically detect the appropriate adapter for the project.
53
+ * @returns A promise that resolves to the auto-detected adapter
54
+ * @throws {Error} If no adapter could be detected for the project
55
+ */
56
+ async getAutoDetectedAdapter() {
57
+ const identifier = await this.adapterIdentifierRegistry.identify(this.options.repoRoot);
58
+ if (!identifier) {
59
+ throw new Error("No project adapter could be auto-detected. " +
60
+ 'Please specify the "adapter" input explicitly in your workflow. ' +
61
+ "Supported adapters: gradle. For more information, see the documentation.");
62
+ }
63
+ logger.info(`🔍 Auto-detected adapter: ${identifier.metadata.id}`);
64
+ return identifier;
65
+ }
66
+ }
@@ -0,0 +1,13 @@
1
+ import { ModuleChangeResult } from "./version-applier.js";
2
+ import { CommitInfo } from "../git/index.js";
3
+ export type ChangelogGeneratorOptions = {
4
+ generateChangelog: boolean;
5
+ repoRoot: string;
6
+ dryRun: boolean;
7
+ };
8
+ export declare class ChangelogGenerator {
9
+ private readonly options;
10
+ constructor(options: ChangelogGeneratorOptions);
11
+ generateChangelogs(moduleResults: ModuleChangeResult[], moduleCommits: Map<string, CommitInfo[]>): Promise<string[]>;
12
+ }
13
+ //# sourceMappingURL=changelog-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"changelog-generator.d.ts","sourceRoot":"","sources":["../../src/services/changelog-generator.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,MAAM,MAAM,yBAAyB,GAAG;IACtC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,yBAAyB;IAEzD,kBAAkB,CACtB,aAAa,EAAE,kBAAkB,EAAE,EACnC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,GACvC,OAAO,CAAC,MAAM,EAAE,CAAC;CAgCrB"}
@@ -0,0 +1,26 @@
1
+ import { logger } from "../utils/logger.js";
2
+ import { generateChangelogsForModules, generateRootChangelog, } from "../changelog/index.js";
3
+ export class ChangelogGenerator {
4
+ options;
5
+ constructor(options) {
6
+ this.options = options;
7
+ }
8
+ async generateChangelogs(moduleResults, moduleCommits) {
9
+ if (!this.options.generateChangelog) {
10
+ logger.info("📚 Skipping changelog generation (disabled by generate-changelog input)");
11
+ return [];
12
+ }
13
+ logger.info("📚 Generating changelogs...");
14
+ if (this.options.dryRun) {
15
+ logger.info("🏃‍♂️ Dry run mode - changelogs will not be written to files");
16
+ return [];
17
+ }
18
+ // Generate individual module changelogs
19
+ const changelogPaths = await generateChangelogsForModules(moduleResults, async (moduleId) => moduleCommits.get(moduleId) || [], this.options.repoRoot);
20
+ // Generate root changelog
21
+ const rootChangelogPath = await generateRootChangelog(moduleResults, this.options.repoRoot);
22
+ changelogPaths.push(rootChangelogPath);
23
+ logger.info(`📝 Generated ${changelogPaths.length} changelog files`);
24
+ return changelogPaths;
25
+ }
26
+ }
@@ -0,0 +1,44 @@
1
+ import { CommitInfo } from "../git/index.js";
2
+ import { ModuleRegistry } from "./module-registry.js";
3
+ /**
4
+ * Analyzes git commits for each module, preventing double-counting in hierarchical structures.
5
+ *
6
+ * @remarks
7
+ * Filters out child module commits from parent modules to ensure each commit is counted
8
+ * only in the most specific module it affects.
9
+ */
10
+ export declare class CommitAnalyzer {
11
+ private readonly moduleRegistry;
12
+ private readonly repoRoot;
13
+ /**
14
+ * Creates a new CommitAnalyzer.
15
+ *
16
+ * @param moduleRegistry - Registry with all discovered modules
17
+ * @param repoRoot - Absolute path to repository root
18
+ */
19
+ constructor(moduleRegistry: ModuleRegistry, repoRoot: string);
20
+ /**
21
+ * Analyzes commits since the last release for all modules.
22
+ *
23
+ * @returns Map of module ID to array of {@link CommitInfo} objects
24
+ * @throws {Error} If git operations fail
25
+ */
26
+ analyzeCommitsSinceLastRelease(): Promise<Map<string, CommitInfo[]>>;
27
+ /**
28
+ * Finds all child module paths for exclusion during commit analysis.
29
+ *
30
+ * @param modulePath - Parent module path
31
+ * @param moduleId - Parent module ID
32
+ * @returns Array of child module paths
33
+ */
34
+ private findChildModulePaths;
35
+ /**
36
+ * Checks if a path is a child subdirectory of a parent path.
37
+ *
38
+ * @param childPath - Path to test
39
+ * @param parentPath - Potential parent path
40
+ * @returns `true` if childPath is a subdirectory of parentPath
41
+ */
42
+ private isChildPath;
43
+ }
44
+ //# sourceMappingURL=commit-analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit-analyzer.d.ts","sourceRoot":"","sources":["../../src/services/commit-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD;;;;;;GAMG;AACH,qBAAa,cAAc;IAQvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAR3B;;;;;OAKG;gBAEgB,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM;IAGnC;;;;;OAKG;IACG,8BAA8B,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IA8C1E;;;;;;OAMG;IACH,OAAO,CAAC,oBAAoB;IAiB5B;;;;;;OAMG;IACH,OAAO,CAAC,WAAW;CAUpB"}