Review fixes

This commit is contained in:
Antoine van der Lee
2026-02-12 20:18:32 +01:00
parent bb97629e43
commit 3a0e46e8c3
4 changed files with 142 additions and 123 deletions
+1 -1
View File
@@ -20,7 +20,7 @@ const existingBlock = readme.slice(startIndex + startMarker.length, endIndex);
const descriptions = new Map();
for (const line of existingBlock.split("\n")) {
const match = line.match(/^\s+([a-z0-9-]+\.md)\s+-\s+(.*)$/i);
const match = line.match(/^\s+([A-Za-z0-9_-]+\.md)\s+-\s+(.*)$/);
if (match) {
descriptions.set(match[1], match[2].trim());
}
+101 -89
View File
@@ -1,114 +1,126 @@
name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g. 1.0.2)"
required: true
type: string
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g. 1.0.2)"
required: true
type: string
permissions:
contents: write
contents: write
jobs:
release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.version }}
release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
VERSION: ${{ inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate version input
run: |
set -euo pipefail
- name: Validate version input
run: |
set -euo pipefail
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version '$VERSION'. Expected format like 1.0.2."
exit 1
fi
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Invalid version '$VERSION'. Expected format like 1.0.2."
exit 1
fi
- name: Fail if tag already exists
run: |
set -euo pipefail
- name: Fail if tag already exists
run: |
set -euo pipefail
if git rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then
echo "Error: Tag $VERSION already exists. Refusing to re-release the same version."
exit 1
fi
if git rev-parse -q --verify "refs/tags/$VERSION" >/dev/null; then
echo "Error: Tag $VERSION already exists. Refusing to re-release the same version."
exit 1
fi
- name: Fail if version is not higher than latest release
run: |
set -euo pipefail
- name: Fail if version is not higher than latest release
run: |
set -euo pipefail
latest_tag="$(git tag -l '[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n 1)"
if [[ -z "$latest_tag" ]]; then
echo "No existing semver tags found. Proceeding with $VERSION."
exit 0
fi
latest_tag="$(git tag -l '[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n 1)"
if [[ -z "$latest_tag" ]]; then
echo "No existing semver tags found. Proceeding with $VERSION."
exit 0
fi
latest_version="$latest_tag"
latest_version="$latest_tag"
if [[ "$VERSION" == "$latest_version" ]]; then
echo "Error: Version $VERSION equals latest released version $latest_version. Use a higher version."
exit 1
fi
if [[ "$VERSION" == "$latest_version" ]]; then
echo "Error: Version $VERSION equals latest released version $latest_version. Use a higher version."
exit 1
fi
greatest="$(printf '%s\n%s\n' "$latest_version" "$VERSION" | sort -V | tail -n 1)"
if [[ "$greatest" != "$VERSION" ]]; then
echo "Error: Version $VERSION must be higher than latest released version $latest_version."
exit 1
fi
greatest="$(printf '%s\n%s\n' "$latest_version" "$VERSION" | sort -V | tail -n 1)"
if [[ "$greatest" != "$VERSION" ]]; then
echo "Error: Version $VERSION must be higher than latest released version $latest_version."
exit 1
fi
- name: Bump plugin.json version
run: |
set -euo pipefail
- name: Bump plugin.json version
run: |
set -euo pipefail
jq --arg v "$VERSION" '.version = $v' .claude-plugin/plugin.json > .claude-plugin/plugin.json.tmp
if [ -s .claude-plugin/plugin.json.tmp ]; then
mv .claude-plugin/plugin.json.tmp .claude-plugin/plugin.json
else
echo "Error: Failed to generate updated .claude-plugin/plugin.json"
exit 1
fi
jq --arg v "$VERSION" '.version = $v' .claude-plugin/plugin.json > .claude-plugin/plugin.json.tmp
if [ -s .claude-plugin/plugin.json.tmp ]; then
mv .claude-plugin/plugin.json.tmp .claude-plugin/plugin.json
else
echo "Error: Failed to generate updated .claude-plugin/plugin.json"
exit 1
fi
- name: Bump marketplace.json versions
run: |
set -euo pipefail
- name: Bump marketplace.json versions
run: |
set -euo pipefail
jq --arg v "$VERSION" '.version = $v | .plugins[0].version = $v' .claude-plugin/marketplace.json > .claude-plugin/marketplace.json.tmp
if [ -s .claude-plugin/marketplace.json.tmp ]; then
mv .claude-plugin/marketplace.json.tmp .claude-plugin/marketplace.json
else
echo "Error: Failed to generate updated .claude-plugin/marketplace.json"
exit 1
fi
jq --arg v "$VERSION" '.version = $v | .plugins[0].version = $v' .claude-plugin/marketplace.json > .claude-plugin/marketplace.json.tmp
if [ -s .claude-plugin/marketplace.json.tmp ]; then
mv .claude-plugin/marketplace.json.tmp .claude-plugin/marketplace.json
else
echo "Error: Failed to generate updated .claude-plugin/marketplace.json"
exit 1
fi
- name: Commit and push version bump
run: |
set -euo pipefail
- name: Commit and push version bump
run: |
set -euo pipefail
if git diff --quiet .claude-plugin/plugin.json .claude-plugin/marketplace.json; then
echo "Error: No changes detected after version bump. Is the repo already at version $VERSION?"
exit 1
fi
if git diff --quiet .claude-plugin/plugin.json .claude-plugin/marketplace.json; then
echo "Error: No changes detected after version bump. Is the repo already at version $VERSION?"
exit 1
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .claude-plugin/plugin.json .claude-plugin/marketplace.json
git commit -m "Bump version to $VERSION"
git push
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add .claude-plugin/plugin.json .claude-plugin/marketplace.json
git commit -m "Bump version to $VERSION"
git push
- name: Create tag and GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
generate_release_notes: true
- name: Create tag and GitHub release
id: create_release
continue-on-error: true
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
generate_release_notes: true
- name: Roll back version bump if release fails
if: steps.create_release.outcome == 'failure'
run: |
set -euo pipefail
git revert --no-edit HEAD
git push
echo "Release creation failed. Reverted the version bump commit on main."
exit 1
+31 -31
View File
@@ -1,40 +1,40 @@
name: Sync README reference structure
on:
pull_request:
paths:
- "swift-testing-expert/references/**"
pull_request:
paths:
- "swift-testing-expert/references/**"
jobs:
sync-readme:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
sync-readme:
# Same-repo PRs only: allow the workflow to auto-sync and push README updates.
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Sync README structure
run: node .github/scripts/sync-readme.js
- name: Sync README structure
run: node .github/scripts/sync-readme.js
- name: Commit README update
run: |
if git diff --quiet README.md; then
echo "README is up to date."
exit 0
fi
- name: Commit README update
run: |
if git diff --quiet README.md; then
echo "README is up to date."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add README.md
git commit -m "chore: sync README references [skip ci]"
git push
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add README.md
git commit -m "chore: sync README references [skip ci]"
git push
+9 -2
View File
@@ -53,13 +53,20 @@ If you use the `skill-creator` skill, you can:
- Standard Markdown editing is sufficient.
- If you add or rename reference files, the README structure is auto-synced via GitHub Actions.
- For same-repo PRs, `.github/workflows/sync-readme-references.yml` may commit and push the README sync change to your branch automatically.
## Validation and Packaging
Run:
Run (replace `<path-to-skill-creator>` with your local install path):
```bash
python3 /Users/avanderlee/.cursor/skills/skill-creator/scripts/package_skill.py ./swift-testing-expert ./dist
python3 <path-to-skill-creator>/scripts/package_skill.py ./swift-testing-expert ./dist
```
Example on many Cursor setups:
```bash
python3 ~/.cursor/skills/skill-creator/scripts/package_skill.py ./swift-testing-expert ./dist
```
The script validates structure/frontmatter and creates a distributable `.skill` file.