From 00e7d81c1d89f3e01501c343895799b3de9e28d7 Mon Sep 17 00:00:00 2001 From: Sutu Sebastian Date: Sat, 4 Jul 2026 13:50:45 +0300 Subject: [PATCH] chore(skills): auto-sync library_version in the changeset version step Wire `scripts/sync-skill-versions.ts` into the `version` script so the changesets "Version packages" PR stamps the current package version into every skills/*/SKILL.md frontmatter alongside the package bump. Keeps `intent stale` quiet without a manual review PR per release. Also bumps the stale `0.0.0` placeholder to the current published `0.1.0`. --- package.json | 2 +- scripts/sync-skill-versions.ts | 24 ++++++++++++++++++++++++ skills/tanstack-store/SKILL.md | 2 +- 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100755 scripts/sync-skill-versions.ts diff --git a/package.json b/package.json index 6c57368..afbe1c7 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,7 @@ "test": "bun test ./src", "test:dom": "vitest run", "typecheck": "tsgo --noEmit", - "version": "changeset version && bun run format CHANGELOG.md" + "version": "changeset version && bun scripts/sync-skill-versions.ts && bun run format CHANGELOG.md" }, "devDependencies": { "@changesets/changelog-github": "0.7.0", diff --git a/scripts/sync-skill-versions.ts b/scripts/sync-skill-versions.ts new file mode 100755 index 0000000..f80f2fe --- /dev/null +++ b/scripts/sync-skill-versions.ts @@ -0,0 +1,24 @@ +#!/usr/bin/env bun +// Stamp `library_version` in every skills/*/SKILL.md frontmatter to the +// current package version. Wired into the `version` script so the changesets +// "Version packages" PR carries the skill bump alongside the package bump — +// keeps `intent stale` quiet without a manual review PR per release. +import { readFileSync, readdirSync, writeFileSync, existsSync } from "node:fs"; +import { join } from "node:path"; + +const { version } = JSON.parse(readFileSync("package.json", "utf8")); +const FIELD = /^( *library_version:\s*")([^"]*)(")/m; + +let touched = 0; +for (const entry of readdirSync("skills", { withFileTypes: true })) { + if (!entry.isDirectory()) continue; + const file = join("skills", entry.name, "SKILL.md"); + if (!existsSync(file)) continue; + const before = readFileSync(file, "utf8"); + const after = before.replace(FIELD, `$1${version}$3`); + if (after !== before) { + writeFileSync(file, after); + touched++; + } +} +console.log(`sync-skill-versions: ${touched} skill(s) → ${version}`); diff --git a/skills/tanstack-store/SKILL.md b/skills/tanstack-store/SKILL.md index a716491..d06ac59 100644 --- a/skills/tanstack-store/SKILL.md +++ b/skills/tanstack-store/SKILL.md @@ -4,7 +4,7 @@ description: Persist a @tanstack/store Store or writable Atom with @stainless-co license: MIT metadata: library: "@stainless-code/persist" - library_version: "0.0.0" + library_version: "0.1.0" framework: "tanstack-store" sources: - README.md