Creates a new release for a blocklet project by bumping version, building, and bundling. Use when asked to "create a new release", "bump and bundle", or "update blocklet version".
Bumps a blocklet project version and creates a release bundle.
Check for project-specific version update scripts before falling back to blocklet version patch.
Check the following in priority order and use the first match:
| Priority | Detection | Command |
|---|---|---|
| 1 | Makefile has bump-version target |
make bump-version |
| 2 | package.json has bump-version script |
pnpm run bump-version |
| 3 | package.json has version script |
pnpm run version |
| 4 | lerna.json exists | lerna version patch --yes |
| 5 | None of the above | blocklet version patch (fallback) |
Detection commands:
# Priority 1: Check Makefile for bump-version target
if [ -f "Makefile" ] && grep -q "^bump-version:" Makefile 2>/dev/null; then
VERSION_CMD="make bump-version"
fi
# Priority 2: Check package.json for bump-version script
if [ -z "$VERSION_CMD" ] && [ -f "package.json" ]; then
if cat package.json | jq -e '.scripts["bump-version"]' > /dev/null 2>&1; then
VERSION_CMD="pnpm run bump-version"
fi
fi
# Priority 3: Check package.json for version script
if [ -z "$VERSION_CMD" ] && [ -f "package.json" ]; then
if cat package.json | jq -e '.scripts["version"]' > /dev/null 2>&1; then
VERSION_CMD="pnpm run version"
fi
fi
# Priority 4: Check for lerna.json
if [ -z "$VERSION_CMD" ] && [ -f "lerna.json" ]; then
VERSION_CMD="lerna version patch --yes"
fi
# Priority 5: Fallback to blocklet version
if [ -z "$VERSION_CMD" ]; then
VERSION_CMD="blocklet version patch"
fi
Run the detected command:
$VERSION_CMD
Important: Project-specific scripts (like make bump-version) often:
version fileCHANGELOG.md entriesIf fails → EXIT with error output.
After version bump, verify and fix CHANGELOG.md if needed.
First, get the actual version that was set (from blocklet.yml or package.json):
# Get version from blocklet.yml
ACTUAL_VERSION=$(grep -E "^version:" blocklet.yml | sed 's/version: *//' | tr -d '"'"'" 2>/dev/null)
# Fallback to package.json if no blocklet.yml
if [ -z "$ACTUAL_VERSION" ]; then
ACTUAL_VERSION=$(cat package.json | jq -r '.version' 2>/dev/null)
fi
# Common CHANGELOG locations in monorepos
CHANGELOG_PATHS=(
"CHANGELOG.md"
"blocklets/*/CHANGELOG.md"
"packages/*/CHANGELOG.md"
)
for pattern in "${CHANGELOG_PATHS[@]}"; do
for file in $pattern; do
if [ -f "$file" ]; then
echo "Found: $file"
fi
done
done
For each CHANGELOG.md found, check if the latest entry matches the actual version:
# Extract first version number from CHANGELOG.md
CHANGELOG_VERSION=$(grep -E "^## \[?[0-9]+\.[0-9]+\.[0-9]+\]?" CHANGELOG.md | head -1 | grep -oE "[0-9]+\.[0-9]+\.[0-9]+")
if [ "$CHANGELOG_VERSION" != "$ACTUAL_VERSION" ]; then
echo "⚠️ Version mismatch!"
echo " CHANGELOG shows: $CHANGELOG_VERSION"
echo " Actual version: $ACTUAL_VERSION"
fi
If CHANGELOG version doesn't match actual version, fix it:
If CHANGELOG has a newer entry with wrong version (e.g., script partially ran):
If CHANGELOG has no entry for the new version:
# Example fix: Replace wrong version in first heading
sed -i "0,/^## \[*$WRONG_VERSION\]*/s//## $ACTUAL_VERSION/" CHANGELOG.md
After fixing version, check if the entry has content:
# Get content between first ## and second ##
ENTRY_CONTENT=$(sed -n '/^## /,/^## /p' CHANGELOG.md | sed '1d;$d' | grep -v "^$")
if [ -z "$ENTRY_CONTENT" ]; then
echo "⚠️ CHANGELOG entry is empty, needs content"
fi
If entry is empty, generate content based on:
# Get commits since last tag
LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
if [ -n "$LAST_TAG" ]; then
git log $LAST_TAG..HEAD --oneline --no-merges
fi
## X.Y.Z (YYYY-MM-DD)
- feat: description of new feature
- fix: description of bug fix
- chore: description of maintenance task
AskUserQuestion to ask user for changelog content.Detect and follow the existing format:
| Format | Example |
|---|---|
| Keep a Changelog | ## [1.2.3] - 2024-01-20 |
| Simple with date | ## 1.2.3 (2024-1-20) |
| Simple no date | ## 1.2.3 |
Date format: Match the existing format in the file (e.g., 2024-01-20 vs 2024-1-20).
Check if package.json exists and contains a build script.
Install dependencies and build:
pnpm install && pnpm run build
If either fails → EXIT with error output.
Skip build step - project is likely pre-built or static.
Find index.html in common locations: dist/ → build/ → out/ → public/ → ./
If not found → EXIT with error message: "No index.html entry point found."
Read blocklet.yml and check the main field:
main points to directory containing index.html → validmain is misaligned → update it to the correct output directoryblocklet meta
If fails → EXIT with error output and suggestions.
blocklet bundle --create-release
If fails → EXIT with error output.
Do NOT output any summary or recap after completion. Simply end silently after successful bundle creation. The tool outputs already provide sufficient feedback to the user.
See {baseDir}/errors.md for all error conditions and suggestions.
errors.md - Error referenceexamples.md - Workflow examples{baseDir} resolves to the skill's installation directory.