fireflyy 4.0.0-dev.4721ae4 → 4.0.0-dev.5da9e52

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.
@@ -0,0 +1,318 @@
1
+ import { r as FireflyOk, s as invalidErr, t as FireflyErr } from "./result.constructors-D9jmQ0uj.js";
2
+ import semver from "semver";
3
+
4
+ //#region src/domain/semver/version.ts
5
+ /**
6
+ * Represents a parsed semantic version with immutable access.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * const result = Version.from("1.2.3-alpha.1");
11
+ * if (result.isOk()) {
12
+ * console.log(result.value.major); // 1
13
+ * console.log(result.value.isPrerelease); // true
14
+ * }
15
+ * ```
16
+ */
17
+ var Version = class Version {
18
+ _raw;
19
+ _parsed;
20
+ constructor(version, parsed) {
21
+ this._raw = version;
22
+ this._parsed = parsed;
23
+ }
24
+ /**
25
+ * Creates a Version from any valid semver string.
26
+ * Handles cleaning (removing 'v' prefix, etc.).
27
+ */
28
+ static from(input) {
29
+ const cleaned = semver.clean(input);
30
+ if (!cleaned) return invalidErr({ message: `"${input}" is not a valid semantic version.` });
31
+ const parsed = semver.parse(cleaned);
32
+ if (!parsed) return invalidErr({ message: `Failed to parse semantic version "${cleaned}".` });
33
+ return FireflyOk(new Version(cleaned, parsed));
34
+ }
35
+ /**
36
+ * Creates a Version from an already-clean semver string.
37
+ * Use when you know the input is already normalized.
38
+ */
39
+ static fromClean(cleanVersion) {
40
+ const parsed = semver.parse(cleanVersion);
41
+ if (!parsed) return invalidErr({ message: `Expected clean version but got invalid: ${cleanVersion}` });
42
+ return FireflyOk(new Version(cleanVersion, parsed));
43
+ }
44
+ /**
45
+ * The raw version string.
46
+ */
47
+ get raw() {
48
+ return this._raw;
49
+ }
50
+ /**
51
+ * Major version number.
52
+ */
53
+ get major() {
54
+ return this._parsed.major;
55
+ }
56
+ /**
57
+ * Minor version number.
58
+ */
59
+ get minor() {
60
+ return this._parsed.minor;
61
+ }
62
+ /**
63
+ * Patch version number.
64
+ */
65
+ get patch() {
66
+ return this._parsed.patch;
67
+ }
68
+ /**
69
+ * Whether this version has prerelease identifiers.
70
+ */
71
+ get isPrerelease() {
72
+ return this._parsed.prerelease.length > 0;
73
+ }
74
+ /**
75
+ * Prerelease identifiers (e.g., ["alpha", 1] for "1.0.0-alpha.1").
76
+ */
77
+ get prerelease() {
78
+ return this._parsed.prerelease;
79
+ }
80
+ /**
81
+ * The prerelease identifier (e.g., "alpha" from "1.0.0-alpha.1").
82
+ */
83
+ get prereleaseIdentifier() {
84
+ if (!this.isPrerelease) return null;
85
+ const first = this._parsed.prerelease[0];
86
+ return typeof first === "string" ? first : null;
87
+ }
88
+ /**
89
+ * The prerelease number (e.g., 1 from "1.0.0-alpha.1").
90
+ */
91
+ get prereleaseNumber() {
92
+ if (!this.isPrerelease) return null;
93
+ const last = this._parsed.prerelease.at(-1);
94
+ return typeof last === "number" ? last : null;
95
+ }
96
+ /**
97
+ * Build metadata identifiers.
98
+ */
99
+ get build() {
100
+ return this._parsed.build;
101
+ }
102
+ /**
103
+ * Returns the raw version string.
104
+ */
105
+ toString() {
106
+ return this._raw;
107
+ }
108
+ /**
109
+ * Checks equality with another Version.
110
+ *
111
+ * @param other - The other Version to compare with
112
+ * @returns True if equal, false otherwise
113
+ */
114
+ equals(other) {
115
+ return semver.eq(this._raw, other._raw);
116
+ }
117
+ /**
118
+ * Compares with another Version: -1 (less), 0 (equal), 1 (greater).
119
+ *
120
+ * @param other - The other Version to compare with
121
+ * @returns -1, 0, or 1 based on comparison
122
+ */
123
+ compare(other) {
124
+ return semver.compare(this._raw, other._raw);
125
+ }
126
+ /**
127
+ * Checks if this version is greater than another.
128
+ *
129
+ * @param other - The other Version to compare with
130
+ * @returns True if this version is greater, false otherwise
131
+ */
132
+ isGreaterThan(other) {
133
+ return semver.gt(this._raw, other._raw);
134
+ }
135
+ /**
136
+ * Checks if this version is less than another.
137
+ *
138
+ * @param other - The other Version to compare with
139
+ * @returns True if this version is less, false otherwise
140
+ */
141
+ isLessThan(other) {
142
+ return semver.lt(this._raw, other._raw);
143
+ }
144
+ /**
145
+ * Checks if this version satisfies a semver range.
146
+ *
147
+ * @param range - The semver range to check against
148
+ * @returns True if it satisfies the range, false otherwise
149
+ */
150
+ satisfies(range) {
151
+ return semver.satisfies(this._raw, range);
152
+ }
153
+ /**
154
+ * Converts a prerelease version to its stable form.
155
+ * "1.2.3-alpha.1" → "1.2.3"
156
+ */
157
+ toStable() {
158
+ const stableVersion = `${this.major}.${this.minor}.${this.patch}`;
159
+ return Version.fromClean(stableVersion);
160
+ }
161
+ };
162
+
163
+ //#endregion
164
+ //#region src/services/implementations/version-bumper.service.ts
165
+ /**
166
+ * Default implementation of the version bumper service.
167
+ */
168
+ var DefaultVersionBumperService = class {
169
+ bump(options) {
170
+ const { currentVersion, releaseType, prereleaseIdentifier, prereleaseBase } = options;
171
+ if (releaseType === "major" || releaseType === "minor" || releaseType === "patch") return this.bumpStandard(currentVersion, releaseType);
172
+ if (releaseType === "premajor" || releaseType === "preminor" || releaseType === "prepatch") return this.bumpPreStandard(currentVersion, releaseType, prereleaseIdentifier, prereleaseBase);
173
+ if (releaseType === "prerelease") return this.bumpPrerelease(currentVersion, prereleaseIdentifier, prereleaseBase);
174
+ if (releaseType === "graduate") return this.graduatePrerelease(currentVersion);
175
+ return invalidErr({
176
+ message: `Unsupported release type: ${releaseType}`,
177
+ source: "services/version-bumper"
178
+ });
179
+ }
180
+ /**
181
+ * Normalizes the prerelease base to a string "0" or "1".
182
+ *
183
+ * @param base - The prerelease base to normalize
184
+ * @returns The normalized base or an error if invalid
185
+ */
186
+ normalizeBase(base) {
187
+ if (base === void 0 || base === null) return FireflyOk(void 0);
188
+ if (base === "0" || base === "1") return FireflyOk(base);
189
+ if (typeof base === "number" && (base === 0 || base === 1)) return FireflyOk(base.toString());
190
+ return invalidErr({ message: `Invalid prerelease base '${base}'. Must be "0", "1", 0, or 1.` });
191
+ }
192
+ /**
193
+ * Determines if the prerelease identifier is complex (contains dots).
194
+ *
195
+ * @param identifier - The prerelease identifier to check
196
+ * @returns True if the identifier is complex, false otherwise
197
+ */
198
+ isComplexIdentifier(identifier) {
199
+ return typeof identifier === "string" && identifier.includes(".");
200
+ }
201
+ /**
202
+ * Bumps a version with a complex prerelease identifier (e.g., "canary.abc123").
203
+ *
204
+ * @param currentVersion - The current version to bump
205
+ * @param identifier - The complex prerelease identifier
206
+ * @returns The new version with the complex identifier
207
+ */
208
+ bumpWithComplexIdentifier(currentVersion, identifier) {
209
+ if (!identifier) return semver.inc(currentVersion.raw, "prerelease", void 0, "0");
210
+ return semver.inc(currentVersion.raw, "prerelease", identifier, false);
211
+ }
212
+ /**
213
+ * Bumps an existing prerelease version.
214
+ *
215
+ * @param currentVersion - The current version to bump
216
+ * @param identifier - Optional prerelease identifier
217
+ * @returns The new prerelease version
218
+ */
219
+ bumpExistingPrerelease(currentVersion, identifier) {
220
+ return identifier ? semver.inc(currentVersion.raw, "prerelease", identifier) : semver.inc(currentVersion.raw, "prerelease");
221
+ }
222
+ /**
223
+ * Bumps a standard version (major, minor, patch) according to the provided release type.
224
+ *
225
+ * @param currentVersion - The current version to bump
226
+ * @param releaseType - The type of standard release
227
+ * @returns The new standard version
228
+ */
229
+ bumpStandard(currentVersion, releaseType) {
230
+ let baseVersionString = currentVersion.raw;
231
+ if (currentVersion.isPrerelease) {
232
+ const stableResult = currentVersion.toStable();
233
+ if (stableResult.isErr()) return FireflyErr(stableResult.error);
234
+ baseVersionString = stableResult.value.raw;
235
+ }
236
+ const newVersionString = semver.inc(baseVersionString, releaseType);
237
+ if (!newVersionString) return invalidErr({
238
+ message: `Failed to bump ${releaseType} version from '${baseVersionString}'.`,
239
+ source: "services/version-bumper"
240
+ });
241
+ return Version.fromClean(newVersionString);
242
+ }
243
+ /**
244
+ * Bumps a pre-standard version (premajor, preminor, prepatch) according to the provided options.
245
+ *
246
+ * @param currentVersion - The current version to bump
247
+ * @param releaseType - The type of pre-standard release
248
+ * @param identifier - Optional prerelease identifier (e.g., "alpha", "beta")
249
+ * @param base - Optional base number for the prerelease
250
+ * @returns The new pre-standard version
251
+ */
252
+ bumpPreStandard(currentVersion, releaseType, identifier, base) {
253
+ const normalizedBaseResult = this.normalizeBase(base);
254
+ if (normalizedBaseResult.isErr()) return FireflyErr(normalizedBaseResult.error);
255
+ const normalizedBase = normalizedBaseResult.value;
256
+ let newVersionString = null;
257
+ if (normalizedBase !== void 0) newVersionString = identifier ? semver.inc(currentVersion.raw, releaseType, identifier, normalizedBase) : semver.inc(currentVersion.raw, releaseType, void 0, normalizedBase);
258
+ else newVersionString = identifier ? semver.inc(currentVersion.raw, releaseType, identifier) : semver.inc(currentVersion.raw, releaseType);
259
+ if (!newVersionString) return invalidErr({
260
+ message: `Failed to bump ${releaseType} version from '${currentVersion.raw}' with identifier '${identifier}' and base '${base}'.`,
261
+ source: "services/version-bumper"
262
+ });
263
+ return Version.fromClean(newVersionString);
264
+ }
265
+ /**
266
+ * Bumps a prerelease version according to the provided options.
267
+ * Handles complex identifiers, explicit bases, continuing existing
268
+ * prereleases, and starting new prereleases from stable versions.
269
+ *
270
+ * @param currentVersion - The current version to bump
271
+ * @param identifier - Optional prerelease identifier (e.g., "alpha", "beta")
272
+ * @param base - Optional base number for the prerelease
273
+ * @returns The new prerelease version
274
+ */
275
+ bumpPrerelease(currentVersion, identifier, base) {
276
+ let newVersionString = null;
277
+ if (this.isComplexIdentifier(identifier)) newVersionString = this.bumpWithComplexIdentifier(currentVersion, identifier);
278
+ else if (base !== void 0 && base !== null) {
279
+ const normalizedBaseResult = this.normalizeBase(base);
280
+ if (normalizedBaseResult.isErr()) return FireflyErr(normalizedBaseResult.error);
281
+ const normalizedBase = normalizedBaseResult.value;
282
+ newVersionString = identifier ? semver.inc(currentVersion.raw, "prerelease", identifier, normalizedBase) : semver.inc(currentVersion.raw, "prerelease", void 0, normalizedBase);
283
+ } else if (currentVersion.isPrerelease) newVersionString = this.bumpExistingPrerelease(currentVersion, identifier);
284
+ else {
285
+ const defaultIdentifier = identifier || "alpha";
286
+ newVersionString = semver.inc(currentVersion.raw, "prerelease", defaultIdentifier);
287
+ }
288
+ if (!newVersionString) return invalidErr({
289
+ message: `Failed to bump prerelease version from '${currentVersion.raw}' with identifier '${identifier}' and base '${base}'.`,
290
+ source: "services/version-bumper"
291
+ });
292
+ return Version.fromClean(newVersionString);
293
+ }
294
+ /**
295
+ * Graduates a prerelease version to its stable counterpart.
296
+ *
297
+ * @param currentVersion - The current prerelease version
298
+ * @returns The stable version
299
+ */
300
+ graduatePrerelease(currentVersion) {
301
+ if (!currentVersion.isPrerelease) return invalidErr({
302
+ message: `Cannot graduate non-prerelease version '${currentVersion.raw}'. Only prerelease versions can be graduated.`,
303
+ source: "services/version-bumper"
304
+ });
305
+ const stableVersionResult = currentVersion.toStable();
306
+ if (stableVersionResult.isErr()) return FireflyErr(stableVersionResult.error);
307
+ return FireflyOk(stableVersionResult.value);
308
+ }
309
+ };
310
+ /**
311
+ * Creates a version bumper service instance.
312
+ */
313
+ function createVersionBumperService() {
314
+ return new DefaultVersionBumperService();
315
+ }
316
+
317
+ //#endregion
318
+ export { createVersionBumperService };
@@ -0,0 +1,258 @@
1
+ import { t as logger } from "./main.js";
2
+ import { g as invalidError, r as FireflyOk, t as FireflyErr } from "./result.constructors-D9jmQ0uj.js";
3
+ import { Result } from "neverthrow";
4
+
5
+ //#region src/services/implementations/version-strategy.service.ts
6
+ const TRANSITION_KEYWORDS = [
7
+ "general availability",
8
+ "promote to stable",
9
+ "move to stable"
10
+ ];
11
+ const LEVEL_TO_RELEASE_TYPE = {
12
+ 0: "major",
13
+ 1: "minor",
14
+ 2: "patch"
15
+ };
16
+ /**
17
+ * Version type categories for organizing choices.
18
+ */
19
+ const VERSION_TYPES = {
20
+ RELEASE: [
21
+ "patch",
22
+ "minor",
23
+ "major"
24
+ ],
25
+ PRERELEASE: [
26
+ "prepatch",
27
+ "preminor",
28
+ "premajor"
29
+ ],
30
+ CONTINUATION: ["prerelease"],
31
+ GRADUATION: ["graduate"]
32
+ };
33
+ /**
34
+ * Pre-configured choice sets for different scenarios.
35
+ */
36
+ const VERSION_CHOICE_SETS = {
37
+ latestIsPreRelease: [
38
+ ...VERSION_TYPES.CONTINUATION,
39
+ ...VERSION_TYPES.GRADUATION,
40
+ ...VERSION_TYPES.RELEASE
41
+ ],
42
+ preRelease: VERSION_TYPES.PRERELEASE,
43
+ default: [...VERSION_TYPES.RELEASE, ...VERSION_TYPES.PRERELEASE]
44
+ };
45
+ /**
46
+ * Human-readable descriptions for each release type.
47
+ */
48
+ const VERSION_DESCRIPTIONS = {
49
+ patch: "Fixes and minor enhancements without breaking compatibility. Suitable for bug fixes and small improvements.",
50
+ minor: "New, backward-compatible functionality. Adds features that do not break existing APIs.",
51
+ major: "Incompatible API changes. Introduces breaking changes or removes deprecated features.",
52
+ prepatch: "Unstable patch release candidate. Used for testing patch changes before a stable release.",
53
+ preminor: "Unstable minor release candidate. Used for previewing new features before a minor release.",
54
+ premajor: "Unstable major release candidate. Used for testing breaking changes before a major release.",
55
+ prerelease: "Unstable pre-release continuation. Increments the pre-release number or changes identifier.",
56
+ graduate: "Promote pre-release to stable. Removes pre-release identifiers to create a stable version."
57
+ };
58
+ var DefaultVersionStrategyService = class {
59
+ bumper;
60
+ constructor(bumper) {
61
+ this.bumper = bumper;
62
+ }
63
+ resolveVersion(options, recommendation) {
64
+ logger.verbose("DefaultVersionStrategyService: Deciding next version...");
65
+ const preReleaseContext = this.analyzePreReleaseContext(options.currentVersion, recommendation);
66
+ if (options.releaseType === "prerelease") {
67
+ logger.verbose("DefaultVersionStrategyService: Handling prerelease request...");
68
+ return this.handlePreReleaseRequest(options, preReleaseContext);
69
+ }
70
+ if (preReleaseContext.isCurrentPreRelease && preReleaseContext.hasStableTransition) {
71
+ logger.verbose("DefaultVersionStrategyService: Handling pre-release to stable transition...");
72
+ return this.handlePreReleaseToStableTransition(options, recommendation);
73
+ }
74
+ if (recommendation) {
75
+ logger.verbose("DefaultVersionStrategyService: Handling recommendation-based versioning...");
76
+ return this.createRecommendationBasedVersion(options, recommendation, preReleaseContext);
77
+ }
78
+ if (options.releaseType) {
79
+ logger.verbose("DefaultVersionStrategyService: Handling explicit release type...");
80
+ return this.bumper.bump({
81
+ currentVersion: options.currentVersion,
82
+ releaseType: options.releaseType,
83
+ prereleaseIdentifier: options.prereleaseIdentifier,
84
+ prereleaseBase: options.prereleaseBase
85
+ });
86
+ }
87
+ return FireflyErr(invalidError({ message: "Cannot determine next version: no release type or recommendation provided" }));
88
+ }
89
+ generateChoices(options) {
90
+ logger.verbose(`DefaultVersionStrategyService: Creating version choices for '${options.currentVersion.raw}'...`);
91
+ const choicesResults = this.determineAvailableVersionTypes(options.currentVersion, options.releaseType).map((releaseType) => this.createSingleChoice(options.currentVersion, releaseType, options.prereleaseIdentifier, options.prereleaseBase));
92
+ const combinedResult = Result.combine(choicesResults);
93
+ if (combinedResult.isErr()) return FireflyErr(combinedResult.error);
94
+ logger.verbose(`DefaultVersionStrategyService: Created ${combinedResult.value.length} version choices.`);
95
+ return FireflyOk(combinedResult.value);
96
+ }
97
+ /**
98
+ * Analyzes the current version and recommendation to determine pre-release context.
99
+ *
100
+ * @param currentVersion - The current version
101
+ * @param recommendation - The version recommendation
102
+ * @returns The pre-release context
103
+ */
104
+ analyzePreReleaseContext(currentVersion, recommendation) {
105
+ return {
106
+ isCurrentPreRelease: currentVersion.isPrerelease,
107
+ prereleaseIdentifier: currentVersion.prereleaseIdentifier,
108
+ hasStableTransition: this.detectStableTransition(recommendation)
109
+ };
110
+ }
111
+ /**
112
+ * Detects if the recommendation indicates a transition to a stable version.
113
+ *
114
+ * @param recommendation - The version recommendation
115
+ * @returns True if a stable transition is detected, false otherwise
116
+ */
117
+ detectStableTransition(recommendation) {
118
+ if (!recommendation) return false;
119
+ const reason = recommendation.reason.toLowerCase();
120
+ return TRANSITION_KEYWORDS.some((keyword) => reason.includes(keyword));
121
+ }
122
+ /**
123
+ * Handles explicit requests for pre-release versions.
124
+ *
125
+ * @param options - The version resolution options
126
+ * @param context - The pre-release context
127
+ * @returns A result containing the new pre-release version or an error
128
+ */
129
+ handlePreReleaseRequest(options, context) {
130
+ logger.verbose("DefaultVersionStrategyService: Bumping to prerelease version...");
131
+ return this.bumper.bump({
132
+ currentVersion: options.currentVersion,
133
+ releaseType: "prerelease",
134
+ prereleaseIdentifier: options.prereleaseIdentifier ?? context.prereleaseIdentifier ?? "alpha",
135
+ prereleaseBase: options.prereleaseBase
136
+ });
137
+ }
138
+ /**
139
+ * Handles the transition from a pre-release version to a stable version.
140
+ *
141
+ * @param options - The version resolution options
142
+ * @param recommendation - The version recommendation
143
+ * @returns A result containing the new stable version or an error
144
+ */
145
+ handlePreReleaseToStableTransition(options, recommendation) {
146
+ if (!recommendation) return FireflyErr(invalidError({
147
+ message: "Cannot transition to stable version without recommendation",
148
+ source: "services/version-strategy"
149
+ }));
150
+ const graduateResult = this.bumper.bump({
151
+ currentVersion: options.currentVersion,
152
+ releaseType: "graduate"
153
+ });
154
+ if (graduateResult.isErr()) return FireflyErr(graduateResult.error);
155
+ const stableVersion = graduateResult.value;
156
+ if (recommendation.level < 2) {
157
+ logger.verbose("DefaultVersionStrategyService: Further bumping after graduation...");
158
+ const releaseType = LEVEL_TO_RELEASE_TYPE[recommendation.level];
159
+ return this.bumper.bump({
160
+ currentVersion: stableVersion,
161
+ releaseType
162
+ });
163
+ }
164
+ logger.verbose("DefaultVersionStrategyService: Graduated to stable version:", stableVersion.raw);
165
+ return FireflyOk(stableVersion);
166
+ }
167
+ /**
168
+ * Creates a new version based on the provided recommendation and pre-release context.
169
+ *
170
+ * @param options - The version resolution options
171
+ * @param recommendation - The version recommendation
172
+ * @param context - The pre-release context
173
+ * @returns A result containing the new version or an error
174
+ */
175
+ createRecommendationBasedVersion(options, recommendation, context) {
176
+ if (context.isCurrentPreRelease && !context.hasStableTransition) {
177
+ logger.verbose("DefaultVersionStrategyService: Continuing prerelease versioning...");
178
+ return this.bumper.bump({
179
+ currentVersion: options.currentVersion,
180
+ releaseType: "prerelease",
181
+ prereleaseIdentifier: options.prereleaseIdentifier ?? context.prereleaseIdentifier ?? "alpha",
182
+ prereleaseBase: options.prereleaseBase
183
+ });
184
+ }
185
+ const releaseType = LEVEL_TO_RELEASE_TYPE[recommendation.level];
186
+ logger.verbose("DefaultVersionStrategyService: Bumping version based on recommendation...");
187
+ return this.bumper.bump({
188
+ currentVersion: options.currentVersion,
189
+ releaseType,
190
+ prereleaseIdentifier: options.prereleaseIdentifier,
191
+ prereleaseBase: options.prereleaseBase
192
+ });
193
+ }
194
+ /**
195
+ * Determines the available version types based on current version and optional release type.
196
+ *
197
+ * @param currentVersion - The current version
198
+ * @param releaseType - Optional specific release type
199
+ * @returns An array of available release types
200
+ */
201
+ determineAvailableVersionTypes(currentVersion, releaseType) {
202
+ if (releaseType !== void 0) return this.getVersionTypesForReleaseType(releaseType);
203
+ return currentVersion.isPrerelease ? VERSION_CHOICE_SETS.latestIsPreRelease : VERSION_CHOICE_SETS.default;
204
+ }
205
+ /**
206
+ * Retrieves the version types applicable for a given release type.
207
+ *
208
+ * @param releaseType - The type of release
209
+ * @returns An array of applicable release types
210
+ */
211
+ getVersionTypesForReleaseType(releaseType) {
212
+ return releaseType === "prerelease" ? VERSION_CHOICE_SETS.preRelease : VERSION_CHOICE_SETS.default;
213
+ }
214
+ /**
215
+ * Retrieves the description for a given release type.
216
+ *
217
+ * @param releaseType - The type of release
218
+ * @returns The description string for the release type
219
+ */
220
+ getVersionDescription(releaseType) {
221
+ return VERSION_DESCRIPTIONS[releaseType] ?? "";
222
+ }
223
+ /**
224
+ * Creates a single version choice based on the provided parameters.
225
+ *
226
+ * @param currentVersion - The current version
227
+ * @param releaseType - The type of release to create
228
+ * @param prereleaseIdentifier - Optional pre-release identifier
229
+ * @param prereleaseBase - Optional base for pre-release
230
+ * @returns A result containing the version choice or an error
231
+ */
232
+ createSingleChoice(currentVersion, releaseType, prereleaseIdentifier, prereleaseBase) {
233
+ const bumpOptions = {
234
+ currentVersion,
235
+ releaseType,
236
+ prereleaseIdentifier,
237
+ prereleaseBase
238
+ };
239
+ const newVersionResult = this.bumper.bump(bumpOptions);
240
+ if (newVersionResult.isErr()) return FireflyErr(newVersionResult.error);
241
+ const newVersion = newVersionResult.value;
242
+ return FireflyOk({
243
+ label: `${releaseType} (${newVersion.raw})`,
244
+ hint: this.getVersionDescription(releaseType),
245
+ value: newVersion.raw
246
+ });
247
+ }
248
+ };
249
+ /**
250
+ * Creates a version strategy service instance.
251
+ * @param bumper - The version bumper service to use
252
+ */
253
+ function createVersionStrategyService(bumper) {
254
+ return new DefaultVersionStrategyService(bumper);
255
+ }
256
+
257
+ //#endregion
258
+ export { TRANSITION_KEYWORDS, createVersionStrategyService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fireflyy",
3
- "version": "4.0.0-dev.4721ae4",
3
+ "version": "4.0.0-dev.5da9e52",
4
4
  "description": " CLI orchestrator for automatic semantic versioning, changelog generation, and creating releases. Built for my own use cases.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -65,7 +65,7 @@
65
65
  "@biomejs/biome": "2.3.8",
66
66
  "@types/bun": "^1.3.3",
67
67
  "@types/semver": "^7.7.1",
68
- "tsdown": "^0.17.0-beta.5",
68
+ "tsdown": "^0.17.0-beta.6",
69
69
  "typescript": "^5.9.3",
70
70
  "ultracite": "6.3.8"
71
71
  },
package/dist/index.d.ts DELETED
@@ -1,79 +0,0 @@
1
- import z from "zod";
2
-
3
- //#region src/cli/config/config.schema.d.ts
4
-
5
- /**
6
- * Complete Firefly configuration schema.
7
- * Combines global options with command-specific configuration sections.
8
- */
9
- declare const FireflyConfigSchema: z.ZodObject<{
10
- release: z.ZodOptional<z.ZodObject<{
11
- name: z.ZodOptional<z.ZodString>;
12
- scope: z.ZodOptional<z.ZodString>;
13
- base: z.ZodDefault<z.ZodString>;
14
- branch: z.ZodOptional<z.ZodString>;
15
- changelogPath: z.ZodDefault<z.ZodString>;
16
- bumpStrategy: z.ZodDefault<z.ZodUnion<[z.ZodEnum<{
17
- auto: "auto";
18
- manual: "manual";
19
- }>, z.ZodLiteral<"">]>>;
20
- releaseType: z.ZodOptional<z.ZodEnum<{
21
- major: "major";
22
- minor: "minor";
23
- patch: "patch";
24
- prerelease: "prerelease";
25
- premajor: "premajor";
26
- preminor: "preminor";
27
- prepatch: "prepatch";
28
- graduate: "graduate";
29
- }>>;
30
- preReleaseId: z.ZodOptional<z.ZodString>;
31
- preReleaseBase: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodLiteral<"0">, z.ZodLiteral<"1">]>>;
32
- releaseNotes: z.ZodDefault<z.ZodString>;
33
- commitMessage: z.ZodDefault<z.ZodString>;
34
- tagName: z.ZodDefault<z.ZodString>;
35
- skipBump: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
36
- skipChangelog: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
37
- skipPush: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
38
- skipGitHubRelease: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
39
- skipGit: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
40
- skipPreflightCheck: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
41
- releaseTitle: z.ZodDefault<z.ZodString>;
42
- releaseLatest: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
43
- releasePreRelease: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
44
- releaseDraft: z.ZodDefault<z.ZodCoercedBoolean<unknown>>;
45
- }, z.core.$strip>>;
46
- cwd: z.ZodOptional<z.ZodString>;
47
- dryRun: z.ZodOptional<z.ZodBoolean>;
48
- verbose: z.ZodOptional<z.ZodBoolean>;
49
- enableRollback: z.ZodOptional<z.ZodBoolean>;
50
- }, z.core.$strip>;
51
- /**
52
- * TypeScript type for Firefly configuration.
53
- * Use this type when you need to reference the configuration shape without runtime validation.
54
- */
55
- type FireflyConfig = z.infer<typeof FireflyConfigSchema>;
56
- //#endregion
57
- //#region src/config/index.d.ts
58
- /**
59
- * Helper function to define a type-safe Firefly configuration.
60
- *
61
- * Provides IntelliSense autocompletion and type checking for config files.
62
- *
63
- * @param options - The configuration options
64
- * @returns The same options (identity function for type inference)
65
- *
66
- * @example
67
- * ```ts
68
- * export default defineConfig({
69
- * verbose: true,
70
- * release: {
71
- * bumpStrategy: "conventional",
72
- * releaseType: "github",
73
- * },
74
- * });
75
- * ```
76
- */
77
- declare function defineConfig<T extends FireflyConfig>(options: T): T;
78
- //#endregion
79
- export { defineConfig };