feat(changelog): add CHANGELOG.md, release extraction script, and developer guidelines (#414)

* feat(changelog): add CHANGELOG.md, release extraction script, and developer guidelines

* docs(agents): simplify changelog guidelines for brevity
This commit is contained in:
Yiling-J
2026-09-18 11:57:25 +08:00
committed by GitHub
parent 76ffb51bb2
commit 3a509537fd
7 changed files with 996 additions and 6 deletions
+40
View File
@@ -99,6 +99,45 @@ function updateVersions(newVersion: string) {
}
}
function updateChangelog(newVersion: string) {
const changelogFile = 'CHANGELOG.md'
if (!existsSync(changelogFile)) {
return
}
const content = readFileSync(changelogFile, 'utf-8')
if (content.includes(`## [${newVersion}]`) || content.includes(`## [v${newVersion}]`)) {
console.log(` Changelog already contains ## [${newVersion}], skipping update`)
return
}
const unreleasedRegex = /^## \[Unreleased\]/m
if (!unreleasedRegex.test(content)) {
console.warn(' Warning: No ## [Unreleased] header found in CHANGELOG.md')
return
}
const now = new Date()
const year = now.getFullYear()
const month = String(now.getMonth() + 1).padStart(2, '0')
const day = String(now.getDate()).padStart(2, '0')
const dateStr = `${year}-${month}-${day}`
const replacement = `## [Unreleased]
### Added
### Fixed
### Changed
## [${newVersion}] - ${dateStr}`
const updatedContent = content.replace(unreleasedRegex, replacement)
writeFileSync(changelogFile, updatedContent, 'utf-8')
console.log(` Updated ${changelogFile} for v${newVersion} (${dateStr})`)
}
function shellQuote(value: string) {
return `'${value.replace(/'/g, `'\\''`)}'`
}
@@ -151,6 +190,7 @@ if (bumpTypes.has(releaseTarget)) {
console.log(`Bumping version from ${currentVersion} to ${newVersion}...`)
updateVersions(newVersion)
updateChangelog(newVersion)
console.log()
// 3. Update bun.lock