MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / bumpSemver

Function bumpSemver

src/tools/git/release-notes.ts:186–196  ·  view source on GitHub ↗
(v: string, kind: 'patch' | 'minor' | 'major')

Source from the content-addressed store, hash-verified

184}
185
186function bumpSemver(v: string, kind: 'patch' | 'minor' | 'major'): string {
187 // Tolerant of "v1.2.3", "1.2.3-rc1", etc. Pre-release suffix is dropped on bump.
188 const m = /^v?(\d+)\.(\d+)\.(\d+)/.exec(v);
189 if (!m) throw new Error(`Cannot parse version: ${v}`);
190 let [_, maj, min, pat] = m;
191 let M = parseInt(maj!), m2 = parseInt(min!), p = parseInt(pat!);
192 if (kind === 'major') { M++; m2 = 0; p = 0; }
193 else if (kind === 'minor') { m2++; p = 0; }
194 else { p++; }
195 return `${M}.${m2}.${p}`;
196}
197
198function bucketsToJson(b: CategoryBuckets): Record<string, Array<{ sha: string; subject: string; scope?: string; date: string; author: string }>> {
199 const out: Record<string, Array<{ sha: string; subject: string; scope?: string; date: string; author: string }>> = {};

Callers 1

executeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected