@wyxos/zephyr 0.9.1 → 0.9.3
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.
package/package.json
CHANGED
|
@@ -60,17 +60,22 @@ function selectVersionSuggestionReference(currentVersion, versionBumps) {
|
|
|
60
60
|
return versionBumps[0] ?? null
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
let earliestKnownCurrentMinor = null
|
|
64
|
+
const currentMinorBoundary = versionBumps.find((versionBump) => {
|
|
65
|
+
const parsed = semver.parse(versionBump.version)
|
|
66
|
+
const isCurrentMinor = parsed
|
|
67
67
|
&& parsed.major === current.major
|
|
68
68
|
&& parsed.minor === current.minor
|
|
69
|
-
&& parsed.patch === 0
|
|
70
69
|
&& parsed.prerelease.length === 0
|
|
70
|
+
|
|
71
|
+
if (isCurrentMinor) {
|
|
72
|
+
earliestKnownCurrentMinor = versionBump
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return isCurrentMinor && parsed.patch === 0
|
|
71
76
|
})
|
|
72
77
|
|
|
73
|
-
return currentMinorBoundary ?? versionBumps[0] ?? null
|
|
78
|
+
return currentMinorBoundary ?? earliestKnownCurrentMinor ?? versionBumps[0] ?? null
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
function formatVersionReferenceLabel(reference, currentVersion) {
|
|
@@ -80,13 +85,14 @@ function formatVersionReferenceLabel(reference, currentVersion) {
|
|
|
80
85
|
|
|
81
86
|
const current = semver.parse(currentVersion)
|
|
82
87
|
const parsed = semver.parse(reference.version)
|
|
83
|
-
const
|
|
88
|
+
const isCurrentMinor = current
|
|
84
89
|
&& parsed
|
|
85
90
|
&& parsed.major === current.major
|
|
86
91
|
&& parsed.minor === current.minor
|
|
87
|
-
&& parsed.patch === 0
|
|
88
92
|
&& parsed.prerelease.length === 0
|
|
89
|
-
const prefix =
|
|
93
|
+
const prefix = isCurrentMinor
|
|
94
|
+
? parsed.patch === 0 ? 'current app minor baseline' : 'earliest known app minor baseline'
|
|
95
|
+
: 'last app version bump'
|
|
90
96
|
|
|
91
97
|
return `${prefix} ${reference.shortHash} (${reference.version})`
|
|
92
98
|
}
|
|
@@ -16,6 +16,15 @@ export const RELEASE_TYPES = [
|
|
|
16
16
|
'prerelease'
|
|
17
17
|
]
|
|
18
18
|
const STABLE_RELEASE_TYPES = ['major', 'minor', 'patch']
|
|
19
|
+
const RELEASE_TYPE_WEIGHTS = {
|
|
20
|
+
prerelease: 0,
|
|
21
|
+
prepatch: 1,
|
|
22
|
+
patch: 1,
|
|
23
|
+
preminor: 2,
|
|
24
|
+
minor: 2,
|
|
25
|
+
premajor: 3,
|
|
26
|
+
major: 3
|
|
27
|
+
}
|
|
19
28
|
|
|
20
29
|
function sanitizeSuggestedReleaseType(message, allowedTypes = RELEASE_TYPES) {
|
|
21
30
|
if (typeof message !== 'string') {
|
|
@@ -70,6 +79,17 @@ function inferReleaseTypeHeuristically({
|
|
|
70
79
|
return 'patch'
|
|
71
80
|
}
|
|
72
81
|
|
|
82
|
+
function applyHeuristicFloor(releaseType, heuristicReleaseType) {
|
|
83
|
+
const releaseWeight = RELEASE_TYPE_WEIGHTS[releaseType] ?? -1
|
|
84
|
+
const heuristicWeight = RELEASE_TYPE_WEIGHTS[heuristicReleaseType] ?? -1
|
|
85
|
+
|
|
86
|
+
if (heuristicWeight > releaseWeight) {
|
|
87
|
+
return heuristicReleaseType
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return releaseType
|
|
91
|
+
}
|
|
92
|
+
|
|
73
93
|
function resolveSuggestedReleaseTypeOptions(currentVersion = '0.0.0') {
|
|
74
94
|
const parsedVersion = semver.parse(currentVersion)
|
|
75
95
|
|
|
@@ -234,10 +254,12 @@ async function suggestReleaseType(rootDir = process.cwd(), {
|
|
|
234
254
|
}
|
|
235
255
|
}
|
|
236
256
|
|
|
257
|
+
const flooredReleaseType = applyHeuristicFloor(releaseType, heuristicReleaseType)
|
|
258
|
+
|
|
237
259
|
return {
|
|
238
260
|
...context,
|
|
239
|
-
releaseType,
|
|
240
|
-
source: 'codex'
|
|
261
|
+
releaseType: flooredReleaseType,
|
|
262
|
+
source: flooredReleaseType === releaseType ? 'codex' : 'codex+heuristic-floor'
|
|
241
263
|
}
|
|
242
264
|
} catch (error) {
|
|
243
265
|
logWarning?.(`Codex could not suggest a release type: ${error.message}`)
|