build: generate crates/tui/CHANGELOG.md as a 15-release slice instead of a full manual copy

The /change command embeds this file into every binary via include_str!;
it now carries only recent releases (regenerated by scripts/sync-changelog.sh,
wired into the release checklist). The explicit-version test derives its
fixture versions from the embedded slice instead of hardcoding old ones.
This commit is contained in:
Hunter B
2026-06-09 23:22:00 -07:00
parent 258d75376c
commit b4edb4e1ef
4 changed files with 36 additions and 4750 deletions
+2 -4748
View File
File diff suppressed because it is too large Load Diff
+9 -2
View File
@@ -869,11 +869,18 @@ Older release.\n";
fn change_with_explicit_version_includes_previous_hint() {
let tmp = tempfile::TempDir::new().unwrap();
let mut app = make_app(&tmp, Locale::En, false);
let result = change(&mut app, Some("0.8.32"));
// Derive versions from the bundled changelog: it only embeds a recent
// slice of releases, so hardcoded versions would age out of it.
let explicit = extract_previous_version_number(DEEPSEEK_TUI_CHANGELOG)
.expect("bundled changelog should have a previous release");
let expected_prev =
extract_previous_version_number_after_version(DEEPSEEK_TUI_CHANGELOG, &explicit)
.expect("bundled changelog should have at least three releases");
let result = change(&mut app, Some(&explicit));
assert!(!result.is_error);
let msg = result.message.as_deref().unwrap_or("");
assert!(
msg.contains("Previous version:") && msg.contains("0.8.31"),
msg.contains("Previous version:") && msg.contains(&expected_prev),
"explicit version should show previous-version hint: {msg}"
);
}
+4
View File
@@ -31,6 +31,10 @@ not enumerate.
if there is something material the user must work around.
- [ ] The entry mentions all referenced issue/PR numbers as `#NNNN` so the
auto-linker on GitHub picks them up.
- [ ] Run `scripts/sync-changelog.sh` to regenerate `crates/tui/CHANGELOG.md`
(the recent-releases slice embedded in the binary for `/change`). Do
not edit that file by hand, and do not copy the full root changelog
into it — older entries live in `docs/CHANGELOG_ARCHIVE.md`.
## 2. Version pins are in sync
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env sh
# Regenerate crates/tui/CHANGELOG.md from the workspace root CHANGELOG.md.
# The /change command embeds this file into the binary via include_str!, so
# it deliberately keeps only the most recent release sections.
#
# Usage: scripts/sync-changelog.sh [sections-to-keep] (default: 15)
set -eu
KEEP="${1:-15}"
root="$(cd "$(dirname "$0")/.." && pwd)"
awk -v keep="$KEEP" '
/^\[/ && /\]: http/ { exit }
/^## \[/ { count++ }
count > keep { exit }
{ print }
' "$root/CHANGELOG.md" > "$root/crates/tui/CHANGELOG.md"
printf '%s\n' \
'---' \
'' \
'Older releases: [CHANGELOG.md](https://github.com/Hmbown/CodeWhale/blob/main/CHANGELOG.md) and [docs/CHANGELOG_ARCHIVE.md](https://github.com/Hmbown/CodeWhale/blob/main/docs/CHANGELOG_ARCHIVE.md).' \
>> "$root/crates/tui/CHANGELOG.md"
echo "wrote crates/tui/CHANGELOG.md ($(wc -l < "$root/crates/tui/CHANGELOG.md") lines, $KEEP sections kept)"