c64bridge 0.7.1 → 0.7.2
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/mcp.json +1 -1
- package/package.json +1 -1
- package/scripts/generate-changelog.mjs +75 -3
package/mcp.json
CHANGED
package/package.json
CHANGED
|
@@ -26,12 +26,84 @@ const run = (cmd) => execSync(cmd, { encoding: 'utf8' }).trim();
|
|
|
26
26
|
const nowDate = new Date().toISOString().slice(0, 10);
|
|
27
27
|
const root = process.cwd();
|
|
28
28
|
|
|
29
|
-
function
|
|
29
|
+
function normaliseVersion(value) {
|
|
30
|
+
return value.startsWith('v') ? value.slice(1) : value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function parseSemver(value) {
|
|
34
|
+
const cleaned = normaliseVersion(value);
|
|
35
|
+
const parts = cleaned.split('.').map((n) => Number.parseInt(n, 10));
|
|
36
|
+
if (parts.length !== 3 || parts.some(Number.isNaN)) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return { tag: value, cleaned, parts };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function compareParts(a, b) {
|
|
43
|
+
for (let i = 0; i < 3; i += 1) {
|
|
44
|
+
if (a.parts[i] !== b.parts[i]) {
|
|
45
|
+
return a.parts[i] - b.parts[i];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return 0;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getLastTag(skipVersion = '') {
|
|
52
|
+
let raw;
|
|
30
53
|
try {
|
|
31
|
-
|
|
54
|
+
raw = run('git tag --sort=version:refname');
|
|
32
55
|
} catch {
|
|
33
56
|
return '';
|
|
34
57
|
}
|
|
58
|
+
|
|
59
|
+
const entries = raw
|
|
60
|
+
.split('\n')
|
|
61
|
+
.map((line) => line.trim())
|
|
62
|
+
.filter(Boolean)
|
|
63
|
+
.map((tag) => parseSemver(tag))
|
|
64
|
+
.filter((info) => info !== null);
|
|
65
|
+
|
|
66
|
+
if (entries.length === 0) {
|
|
67
|
+
return '';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const grouped = new Map();
|
|
71
|
+
for (const entry of entries) {
|
|
72
|
+
if (!grouped.has(entry.cleaned)) {
|
|
73
|
+
grouped.set(entry.cleaned, []);
|
|
74
|
+
}
|
|
75
|
+
grouped.get(entry.cleaned).push(entry);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const ordered = Array.from(grouped.values())
|
|
79
|
+
.map((group) => ({ cleaned: group[0].cleaned, parts: group[0].parts, group }))
|
|
80
|
+
.sort((a, b) => compareParts(a, b));
|
|
81
|
+
|
|
82
|
+
if (ordered.length === 0) {
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
if (!skipVersion) {
|
|
87
|
+
const latest = ordered[ordered.length - 1];
|
|
88
|
+
return (latest.group.find((entry) => !entry.tag.startsWith('v')) || latest.group[latest.group.length - 1]).tag;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const skipCleaned = normaliseVersion(skipVersion);
|
|
92
|
+
let previous = null;
|
|
93
|
+
for (const entry of ordered) {
|
|
94
|
+
if (entry.cleaned === skipCleaned) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
previous = entry;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (previous) {
|
|
101
|
+
return (previous.group.find((entry) => !entry.tag.startsWith('v')) || previous.group[previous.group.length - 1]).tag;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// If skip version was not found among tags, fall back to latest tag.
|
|
105
|
+
const fallback = ordered[ordered.length - 1];
|
|
106
|
+
return (fallback.group.find((entry) => !entry.tag.startsWith('v')) || fallback.group[fallback.group.length - 1]).tag;
|
|
35
107
|
}
|
|
36
108
|
|
|
37
109
|
function getCommits(range) {
|
|
@@ -90,7 +162,7 @@ function renderSection(version, date, groups) {
|
|
|
90
162
|
|
|
91
163
|
async function main() {
|
|
92
164
|
const version = process.argv[2] || '';
|
|
93
|
-
const lastTag = getLastTag();
|
|
165
|
+
const lastTag = getLastTag(version);
|
|
94
166
|
const range = lastTag ? `${lastTag}..HEAD` : '';
|
|
95
167
|
const rawCommits = getCommits(range)
|
|
96
168
|
.filter((c) => c.subject && !/^Merge\s/.test(c.subject));
|