feat(cli): skillforge update <path> --bump|--new-version for SKILL.md version bumps - #12
Conversation
Fifth piece of the SKILL.md authoring workflow after init, validate, pack, install, and lint. Bumps the version: field of a SKILL.md in one shot — either --bump <patch|minor|major> or --new-version <semver>, mutually exclusive. Pre-release tags drop on any bump (npm-style). A missing version field is treated as the schema default 0.0.1 so patch on a freshly-scaffolded skill produces 0.0.2. Validates the proposed frontmatter against the schema before touching disk; line-surgical write preserves body bytes and YAML formatting byte-for-byte.
|
Warning Review limit reached
Your plan currently allows 1 review/hour. Refill in 31 minutes and 46 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
skillforge update <path>— bump theversion:field of a SKILL.md without hand-editing the frontmatter. Fifth piece of the authoring workflow afterinit,validate,pack,install, andlint.Semantics
--bump patchfrom1.2.31.2.4--bump minorfrom1.2.31.3.0--bump majorfrom1.2.32.0.0--bump <any>from1.2.3-betanpm version)--bump patchwith noversion:field0.0.1(schema default), result0.0.2--new-version 2.0.0-rc.1--new-version notsemver--bumpand--new-versionSKILL.md--dry-runreports the would-be new version and writes nothing.Body preservation
gray-matter.stringify()re-emits YAML throughjs-yaml, which has opinions about quoting, block-scalar style, and key spacing. Round-tripping a human-authored SKILL.md through it almost always changes something — fine for newly-scaffolded files, lossy for files a human just edited.So
updatedoes NOT round-trip. It parses the file withgray-matteronly to read the current version, then performs a line-surgical edit of just theversion:line in the original raw text. Body bytes, field order, comments, and the rest of the YAML formatting are preserved byte-for-byte. If there's noversion:line at all (schema-default case), one is inserted immediately after the opening---fence so it sits next toname:/description:.A dedicated test (
leaves the body bytes byte-for-byte identical (prose + code blocks + lists)) writes a rich body (italics, bold, nested bullets, ordered list, fenced python code, blockquote, link, trailing line) and asserts byte equality after apatchbump.Validation
The proposed frontmatter is validated against
SkillFrontmatterSchemabefore anything hits disk. If the file already had a problem the bump can't fix (e.g. adescriptionunder 20 chars), the command exits 1 with the schema error and the file is left untouched — never a half-written, schema-invalid SKILL.md on disk.Exit codes
Same posture as
init/validate/pack/install/lint.Surface
src/update.ts—updateSkillVersion()+bumpVersion()+ line-surgical writer. ~190 LOC.src/update.test.ts— 27 tests covering each bump direction, schema-default baseline, prerelease stripping, dry-run,--new-versionhappy + sad paths, rich-body preservation, frontmatter field-order + colon-spacing preservation, file-not-found, dir-without-SKILL.md, mutual exclusion (both flags + neither), schema-refusal.src/cli.ts— newupdatesubcommand with--bump,--new-version,--dry-run.src/index.ts— re-exportsupdateSkillVersion,bumpVersion,BumpKind,UpdateOptions,UpdateResult.README.md— new### skillforge update <path>section; status line updated.CHANGELOG.md—Unreleasedentry (no version-section migration; that's a release-prep PR).No new runtime deps — reuses
gray-matter,zod,kleur,cacalready on the tree. Lockfile untouched.Test plan
pnpm typecheck(tsc --noEmit)pnpm lint(biome)pnpm test(vitest)pnpm build(tsup)./dist/cli.js update ./tmp-skill --bump patch --dry-rundry-run … 0.4.2 → 0.4.3 (nothing written), file unchanged./dist/cli.js update … --bump minor0.4.2 → 0.5.0, fileversion: 0.5.0./dist/cli.js update … --new-version 1.0.00.5.0 → 1.0.0./dist/cli.js update … --new-version notsemver./dist/cli.js update … --bump patch --new-version 1.2.3On a
--fix/ autocommit follow-upOut of scope here. Natural next step is a
--commitflag that opens an editor on the resulting frontmatter (or justgit add SKILL.md && git commit -m "chore: bump to vX.Y.Z"), but the v1 of this command should stay a pure file rewrite — composes cleanly with whatever VCS workflow the author already has.Declaration of AI-Tools / LLMs usage