Skip to content

Commit f1b36da

Browse files
authoredand pushed
Merge pull request #600 from jamesmontemagno/agents/release-canvas-access
Fix release process for versioning and changelog updates
2 parents a1ad38b + c1fa14b commit f1b36da

8 files changed

Lines changed: 173 additions & 18 deletions

File tree

‎.github/extensions/tinyclips-release-hub/release-data.mjs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,15 @@ function compareTags(left, right) {
9393
return 0;
9494
}
9595

96-
function nextPatchTag(platform, latestTag, appVersion) {
96+
export function nextPatchTag(platform, latestTag, appVersion) {
9797
if (platform === "agent") {
9898
return appVersion ? `agent-v${appVersion}` : "agent-v0.1.0";
9999
}
100100
if (platform === "mac" && appVersion) {
101101
const prefix = `v${appVersion}.`;
102-
const matchingPatch = latestTag?.startsWith(prefix) ? parseReleaseTagVersion(latestTag)[2] : -1;
102+
const component = appVersion.split(".").length === 3 ? 3 : 2;
103+
const matchesAppVersion = latestTag?.startsWith(prefix) || latestTag === `v${appVersion}-mac`;
104+
const matchingPatch = matchesAppVersion ? parseReleaseTagVersion(latestTag)[component] : -1;
103105
return `${prefix}${matchingPatch + 1}-mac`;
104106
}
105107
const [major, minor, patch] = parseReleaseTagVersion(latestTag ?? "");
@@ -633,6 +635,9 @@ export async function generateReleaseNotes(platform, version) {
633635
? extractReleaseSection(markdown, platform, version) || extractSection(markdown, config.unreleasedHeading)
634636
: extractSection(markdown, config.unreleasedHeading);
635637
const tag = version || "NEXT_VERSION";
638+
if (platform !== "agent" && countNotes(body) === 0) {
639+
throw new Error(`No release notes found for ${version || "Unreleased"} in ${config.changelog}. Add bullet points under ${config.unreleasedHeading} before preparing.`);
640+
}
636641
const install = platform === "mac"
637642
? [
638643
"## Install",

‎.github/extensions/tinyclips-release-hub/renderer.mjs‎

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,8 @@ export function renderHtml({ instanceId, token }) {
904904
const actualReleasePublished = data.latestRelease?.tagName === version;
905905
const tagPushed = actualTagPushed || (demo?.tag === version && demo.pushed);
906906
const releasePublished = actualReleasePublished || (demo?.tag === version && demo.published);
907-
const canPrepareRelease = demoMode || snapshot.git.canPrepareRelease;
907+
const hasReleaseNotes = data.unreleasedCount > 0;
908+
const canPrepareRelease = demoMode || (snapshot.git.canPrepareRelease && hasReleaseNotes);
908909
const canCreateReleasePr = demoMode || snapshot.git.canCreateReleasePr;
909910
const releasePullRequest = data.releasePullRequest?.pullRequest;
910911
const releasePrExists = Boolean(releasePullRequest) || demo?.prCreated === true;
@@ -919,16 +920,20 @@ export function renderHtml({ instanceId, token }) {
919920
? '<span class="badge warn">Demo Mode</span>'
920921
: (!snapshot.git.atMainTip
921922
? '<span class="badge warn">Latest main required</span>'
922-
: (snapshot.git.clean
923-
? '<span class="badge good">Ready to prepare</span>'
924-
: '<span class="badge warn">Commit changes first</span>')));
923+
: (!snapshot.git.clean
924+
? '<span class="badge warn">Commit changes first</span>'
925+
: (hasReleaseNotes
926+
? '<span class="badge good">Ready to prepare</span>'
927+
: '<span class="badge warn">Add release notes</span>'))));
925928
const prepareDetail = preparedLocally
926929
? "Prepared locally. Create a release PR to send the changelog commit for review."
927930
: (demoMode
928931
? "Simulates the changelog commit and release tag without changing Git."
929932
: (!snapshot.git.atMainTip
930933
? "Start from the latest origin/main with no additional commits."
931-
: "Moves Unreleased notes into a dated section, commits, and creates an annotated tag."));
934+
: (!hasReleaseNotes
935+
? "Add bullet points under Unreleased in " + data.changelog + " and commit them before preparing."
936+
: "Moves Unreleased notes into a dated section, commits, and creates an annotated tag.")));
932937
const createPrDetail = demoMode
933938
? (tagPushed ? "PR and tag publication simulated. No branch or tag was sent to origin." : "Simulates creating a release pull request.")
934939
: (tagPushed

‎.github/extensions/tinyclips-release-hub/tests/release-hub.test.mjs‎

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import assert from "node:assert/strict";
2+
import { execFileSync } from "node:child_process";
3+
import { copyFileSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4+
import { tmpdir } from "node:os";
5+
import { dirname, join, resolve } from "node:path";
26
import test from "node:test";
3-
import { generateReleaseNotes, parseReleaseTagVersion } from "../release-data.mjs";
7+
import { fileURLToPath, pathToFileURL } from "node:url";
8+
import { generateReleaseNotes, nextPatchTag, parseReleaseTagVersion } from "../release-data.mjs";
49
import { renderHtml } from "../renderer.mjs";
510

611
test("parses app and agent release tag versions", () => {
@@ -9,6 +14,24 @@ test("parses app and agent release tag versions", () => {
914
assert.deepEqual(parseReleaseTagVersion("agent-v0.2.0-preview.1"), [0, 2, 0, 0]);
1015
});
1116

17+
test("suggests macOS release revisions without changing the app version", () => {
18+
assert.equal(nextPatchTag("mac", "v2.1.0.0-mac", "2.1.0"), "v2.1.0.1-mac");
19+
assert.equal(nextPatchTag("mac", "v2.1.0.5-mac", "2.1.0"), "v2.1.0.6-mac");
20+
assert.equal(nextPatchTag("mac", "v2.1.0-mac", "2.1.0"), "v2.1.0.1-mac");
21+
assert.equal(nextPatchTag("mac", "v2.1.0.5-mac", "2.2.0"), "v2.2.0.0-mac");
22+
assert.equal(nextPatchTag("mac", null, "2.1.0"), "v2.1.0.0-mac");
23+
assert.equal(nextPatchTag("mac", "v1.5.2-mac", "1.5"), "v1.5.3-mac");
24+
assert.equal(nextPatchTag("windows", "v2.1.0-windows", null), "v2.1.1-windows");
25+
});
26+
27+
test("generates macOS notes from the requested released section", async () => {
28+
const result = await generateReleaseNotes("mac", "v2.1.0.0-mac");
29+
30+
assert.match(result.notes, /Studio annotations can be emoji/);
31+
assert.doesNotMatch(result.notes, /The Release Hub suggests the next fourth component/);
32+
assert.ok(result.itemCount > 0);
33+
});
34+
1235
test("generates agent release notes from the shared changelog", async () => {
1336
const result = await generateReleaseNotes("agent", "0.1.0");
1437

@@ -24,3 +47,100 @@ test("renders the Agent tab and guarded publish action", () => {
2447
assert.match(html, /publish_agent_release/);
2548
assert.match(html, /NuGet Trusted Publishing/);
2649
});
50+
51+
const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), "../../../..");
52+
const runners = [
53+
{ name: "Bash", command: "bash", extension: "sh" },
54+
{ name: "PowerShell", command: process.platform === "win32" ? "powershell" : "pwsh", extension: "ps1" },
55+
];
56+
57+
function createReleaseFixture(t, platform, notes, runner) {
58+
const root = mkdtempSync(join(tmpdir(), "tinyclips-release-test-"));
59+
t.after(() => rmSync(root, { recursive: true, force: true }));
60+
const scriptDir = join(root, ".github", "skills", "tag-new-release");
61+
mkdirSync(scriptDir, { recursive: true });
62+
const script = join(scriptDir, `tag-new-release.${runner.extension}`);
63+
copyFileSync(join(repoRoot, ".github", "skills", "tag-new-release", `tag-new-release.${runner.extension}`), script);
64+
mkdirSync(join(root, "mac", "TinyClips"), { recursive: true });
65+
writeFileSync(join(root, "mac", "TinyClips", "Info.plist"), '<?xml version="1.0"?><plist version="1.0"><dict><key>CFBundleShortVersionString</key><string>2.1.0</string></dict></plist>');
66+
mkdirSync(join(root, "windows"));
67+
const heading = platform === "mac" ? "## Unreleased" : "## [Unreleased]";
68+
const changelog = join(root, platform === "mac" ? "CHANGELOG.md" : "windows/CHANGELOG.md");
69+
const original = `# Changelog\n\n${heading}\n\n${notes}\n\n## Previous release\n\n### Fixed\n- Previously released fix.\n`;
70+
writeFileSync(changelog, original);
71+
const git = (...args) => execFileSync("git", args, { cwd: root, encoding: "utf8", env: { ...process.env, GIT_PAGER: "cat" } }).trim();
72+
git("init", "--quiet");
73+
git("config", "user.name", "Release Tests");
74+
git("config", "user.email", "release-tests@example.invalid");
75+
git("config", "commit.gpgsign", "false");
76+
git("config", "tag.gpgsign", "false");
77+
git("add", ".");
78+
git("commit", "--quiet", "-m", "Initial fixture");
79+
const head = git("rev-parse", "HEAD");
80+
const tag = platform === "mac" ? "v2.1.0.1-mac" : "v2.1.1-windows";
81+
const args = runner.extension === "sh"
82+
? [script, "--platform", platform, "--version", tag]
83+
: ["-NoProfile", "-File", script, "-Platform", platform, "-Version", tag];
84+
const run = (dryRun = false) => execFileSync(runner.command, [
85+
...args,
86+
...(dryRun ? [runner.extension === "sh" ? "--dry-run" : "-DryRun"] : []),
87+
], { cwd: root, encoding: "utf8", stdio: "pipe" });
88+
return { root, git, run, changelog, original, head, tag };
89+
}
90+
91+
for (const platform of ["mac", "windows"]) {
92+
test(`rejects ${platform} release-note previews when Unreleased has no bullets`, async (t) => {
93+
const fixture = createReleaseFixture(t, platform, "### Fixed\n", runners[0]);
94+
const moduleDir = join(fixture.root, ".github", "extensions", "tinyclips-release-hub");
95+
mkdirSync(moduleDir, { recursive: true });
96+
for (const file of ["release-data.mjs", "settings.mjs"]) {
97+
copyFileSync(join(repoRoot, ".github", "extensions", "tinyclips-release-hub", file), join(moduleDir, file));
98+
}
99+
const { generateReleaseNotes: generate } = await import(pathToFileURL(join(moduleDir, "release-data.mjs")).href);
100+
101+
await assert.rejects(generate(platform, fixture.tag), /No release notes found.*Add bullet points/);
102+
});
103+
}
104+
105+
for (const runner of runners) {
106+
for (const platform of ["mac", "windows"]) {
107+
const skip = runner.extension === "sh" && platform === "mac" && process.platform !== "darwin"
108+
? "The macOS Bash script requires PlistBuddy."
109+
: false;
110+
for (const notes of ["", "### Fixed\n"]) {
111+
test(`${runner.name} ${platform} rejects ${notes ? "heading-only" : "empty"} notes without changing Git or the changelog`, { skip }, (t) => {
112+
const fixture = createReleaseFixture(t, platform, notes, runner);
113+
114+
assert.throws(() => fixture.run(), (error) => {
115+
assert.match(error.stderr.toString(), /contains no release notes/);
116+
return true;
117+
});
118+
assert.equal(readFileSync(fixture.changelog, "utf8"), fixture.original);
119+
assert.equal(fixture.git("status", "--porcelain"), "");
120+
assert.equal(fixture.git("rev-parse", "HEAD"), fixture.head);
121+
assert.equal(fixture.git("tag", "--list"), "");
122+
});
123+
}
124+
125+
test(`${runner.name} ${platform} previews without mutation and prepares an annotated release with only Unreleased notes`, { skip }, (t) => {
126+
const fixture = createReleaseFixture(t, platform, "### Fixed\n- New release fix.", runner);
127+
128+
const preview = fixture.run(true);
129+
assert.match(preview, /Fixed:\s+- New release fix\./);
130+
assert.doesNotMatch(preview, /Previously released fix/);
131+
assert.equal(readFileSync(fixture.changelog, "utf8"), fixture.original);
132+
assert.equal(fixture.git("status", "--porcelain"), "");
133+
assert.equal(fixture.git("rev-parse", "HEAD"), fixture.head);
134+
assert.equal(fixture.git("tag", "--list"), "");
135+
136+
fixture.run();
137+
assert.equal(fixture.git("cat-file", "-t", `refs/tags/${fixture.tag}`), "tag");
138+
assert.equal(fixture.git("rev-list", "-n", "1", fixture.tag), fixture.git("rev-parse", "HEAD"));
139+
assert.match(fixture.git("for-each-ref", "--format=%(contents)", `refs/tags/${fixture.tag}`), /Fixed:\s+- New release fix\./);
140+
assert.doesNotMatch(fixture.git("for-each-ref", "--format=%(contents)", `refs/tags/${fixture.tag}`), /Previously released fix/);
141+
assert.match(readFileSync(fixture.changelog, "utf8"), /## (?:v2\.1\.0\.1-mac|\[v2\.1\.1-windows\]) - \d{4}-\d{2}-\d{2}/);
142+
assert.match(readFileSync(fixture.changelog, "utf8"), /Previously released fix/);
143+
assert.equal(fixture.git("status", "--porcelain"), "");
144+
});
145+
}
146+
}

‎.github/skills/tag-new-release/SKILL.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ When asked to tag a new release:
5252
- macOS: root `CHANGELOG.md`
5353
- Windows: `windows/CHANGELOG.md`
5454
4. **Update changelog** - Insert the release heading with today's date below Unreleased.
55+
- Unreleased must contain at least one release-note bullet. Previously released sections are not reused automatically.
56+
- Both scripts validate notes before writing the changelog; missing-note failures and dry runs leave the working tree unchanged.
5557
5. **Verify the working directory** - Ensure there are no uncommitted changes before creating commit/tag.
5658
6. **Create commit** - Commit the changelog release marker.
5759
7. **Create an annotated git tag** with:
@@ -85,8 +87,19 @@ The tag message should include cleanly formatted release notes from the selected
8587
- Do not push tags without explicit user approval.
8688
- If the requested version conflicts with existing tags, stop and ask the user how to proceed.
8789
- When the version is provided explicitly by the user, honor that value even if it differs from the app's current `Info.plist` version.
90+
- The Release Hub suggests the next fourth component for three-part macOS app versions: app version `2.1.0` and latest tag `v2.1.0.0-mac` suggest `v2.1.0.1-mac`. Two-part app versions retain third-component increments.
8891

8992
## Files included
9093

9194
- `tag-new-release.sh` - Script that automates changelog release marking, commit creation, and annotated tagging for macOS or Windows.
9295
- `tag-new-release.ps1` - PowerShell equivalent for running the same release-tag workflow natively on Windows.
96+
97+
## Validation
98+
99+
With Node.js, Git, Bash, and PowerShell available, run:
100+
101+
```bash
102+
node --test .github/extensions/tinyclips-release-hub/tests/release-hub.test.mjs
103+
```
104+
105+
The tests use disposable repositories for missing notes, mutation-free previews, and annotated tag creation on both platforms. Bash macOS cases require macOS and PlistBuddy.

‎.github/skills/tag-new-release/tag-new-release.ps1‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ function Build-TagMessage {
9595
}
9696
}
9797

98-
if (-not ($body | Where-Object { $_ -match '^.+:\s*$' -or $_ -match '^\-\s+' })) {
99-
throw "Release notes for $TagVersion are missing after changelog update."
98+
if (-not ($body | Where-Object { $_ -match '^\-\s+' })) {
99+
throw "Unreleased contains no release notes. Add bullet points before preparing $TagVersion."
100100
}
101101

102102
$messageLines = New-Object System.Collections.Generic.List[string]

‎.github/skills/tag-new-release/tag-new-release.sh‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,18 @@ END {
187187
exit 1
188188
}
189189

190-
cp "$TMP_CHANGELOG" "$CHANGELOG_FILE"
191-
192190
if ! awk -v heading="$RELEASE_HEADING" '
193191
BEGIN { cap=0; found=0; hasNotes=0 }
194192
$0 == heading { cap=1; found=1; next }
195193
/^## / && cap { exit }
196194
cap {
197-
if ($0 ~ /^### / || $0 ~ /^- /) {
195+
if ($0 ~ /^- /) {
198196
hasNotes=1
199197
}
200198
}
201199
END { if (!found || !hasNotes) exit 1 }
202-
' "$CHANGELOG_FILE"; then
203-
echo "❌ Release notes for ${VERSION} are missing after changelog update." >&2
200+
' "$TMP_CHANGELOG"; then
201+
echo "❌ Unreleased in ${CHANGELOG_FILE} contains no release notes. Add bullet points before preparing ${VERSION}." >&2
204202
exit 1
205203
fi
206204

@@ -218,7 +216,7 @@ fi
218216
print $0
219217
}
220218
}
221-
' "$CHANGELOG_FILE"
219+
' "$TMP_CHANGELOG"
222220
} > "$TMP_TAG_MSG"
223221

224222
if [[ "$DRY_RUN" == "true" ]]; then
@@ -229,10 +227,10 @@ if [[ "$DRY_RUN" == "true" ]]; then
229227
echo ""
230228
echo "Tag message preview:"
231229
cat "$TMP_TAG_MSG"
232-
git checkout -- "$CHANGELOG_FILE"
233230
exit 0
234231
fi
235232

233+
cp "$TMP_CHANGELOG" "$CHANGELOG_FILE"
236234
git add "$CHANGELOG_FILE"
237235
git commit -m "Mark ${VERSION} release
238236

‎CHANGELOG.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
44

55
## Unreleased
66

7+
### Fixed
8+
- The Release Hub suggests the next fourth component for macOS release tags such as `v2.1.0.1-mac`, instead of changing the app version's patch component. Empty Unreleased notes block preparation with an actionable message; failed note validation and dry runs leave the changelog unchanged in both tagging scripts.
9+
10+
### Changed
11+
- The What's New window now introduces 2.1 on macOS: Agent Control first, with a diagram of what it lets agents use, a reminder that it is off until you turn it on, and a button to its settings. Studio follows with its existing switch, which keeps your saved choice, then what's new in Studio and more to try. It appears once for returning users.
12+
713
## v2.1.0.0-mac - 2026-11-08
814

915
### Added
@@ -20,7 +26,6 @@ All notable changes to this project will be documented in this file.
2026
- Studio has a Captions panel: import an SRT or WebVTT file, timed to the recording or to the edited video; correct or delete a caption; check for readability problems and fix what is safe to fix; and export the video's captions as SRT or WebVTT. Agents can do the same with `studio.captions.import`, `studio.captions.check`, `studio.captions.fix`, and `studio.captions.export`.
2127

2228
### Changed
23-
- The What's New window now introduces 2.1 on macOS: Agent Control first, with a diagram of what it lets agents use, a reminder that it is off until you turn it on, and a button to its settings. Studio follows with its existing switch, which keeps your saved choice, then what's new in Studio and more to try. It appears once for returning users.
2429
- Agent Control on macOS does not require a supporter tip. The shared agent API no longer lists an unused Pro-required error.
2530
- Closing Studio asks a clearer question, on macOS and Windows. A recording that has not been saved as a project asks **Keep this recording?** with Keep as Draft, Delete, and Cancel. A project saved to a folder closes without a question unless it has changes, and then asks **Save changes?** with Save, Don't Save (which puts back the project as it was last saved), and Cancel. Export is no longer offered when closing.
2631
- Studio's short choices, such as layout, transition, zoom focus, camera shape and background, and an annotation's size and attachment, are now segmented controls like the Captions panel's, on macOS and Windows. The rectangle annotation's key is now H, for a highlight box.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"id" : "0a834533-7602-4978-b170-06399b9b1969",
3+
"targets" : [
4+
{
5+
"id" : "31C332AA-FBB8-441D-98EF-1FFA6F01B9F8",
6+
"name" : "TinyClipsMAS"
7+
}
8+
]
9+
}

0 commit comments

Comments
 (0)