-
Notifications
You must be signed in to change notification settings - Fork 6
[Template Sync] feat: update cursor skills to use subdirectory structure and kebab-case names #26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
liukatkat
wants to merge
1
commit into
main
from
template-sync/74d3720998beeada6873d0fa47d2074f11c54b2e
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Require Version Bump Label | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, labeled, unlabeled, synchronize] | ||
|
|
||
| jobs: | ||
| check-plugin-changes: | ||
| name: Check for Plugin Changes | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| has_plugin_changes: ${{ steps.check.outputs.has_changes }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Check if plugin files changed | ||
| id: check | ||
| env: | ||
| BASE_REF: ${{ github.base_ref }} | ||
| run: | | ||
| # Get list of changed files | ||
| CHANGED_FILES=$(git diff --name-only origin/"$BASE_REF"...HEAD) | ||
|
|
||
| # Define plugin file patterns (adjust based on repo structure) | ||
| # For Claude: plugin/, For Cursor: hooks/, mcp.json, skills/, scripts/ | ||
| PLUGIN_PATTERNS="plugin/|hooks/|mcp\.json|\.mcp\.json|skills/|scripts/|commands/|semgrep-version" | ||
|
|
||
| if echo "$CHANGED_FILES" | grep -qE "$PLUGIN_PATTERNS"; then | ||
| echo "has_changes=true" >> $GITHUB_OUTPUT | ||
| echo "Plugin files changed:" | ||
| echo "$CHANGED_FILES" | grep -E "$PLUGIN_PATTERNS" || true | ||
| else | ||
| echo "has_changes=false" >> $GITHUB_OUTPUT | ||
| echo "No plugin files changed" | ||
| fi | ||
|
|
||
| check-version-label: | ||
| name: Check Version Bump Label | ||
| needs: check-plugin-changes | ||
| if: needs.check-plugin-changes.outputs.has_plugin_changes == 'true' | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| PR_LABELS: ${{ toJson(github.event.pull_request.labels.*.name) }} | ||
| steps: | ||
| - name: Check for version bump label | ||
| run: | | ||
| if echo "$PR_LABELS" | grep -q '"bump:patch"'; then | ||
| echo "✓ Found label: bump:patch" | ||
| exit 0 | ||
| elif echo "$PR_LABELS" | grep -q '"bump:minor"'; then | ||
| echo "✓ Found label: bump:minor" | ||
| exit 0 | ||
| elif echo "$PR_LABELS" | grep -q '"bump:major"'; then | ||
| echo "✓ Found label: bump:major" | ||
| exit 0 | ||
| else | ||
| echo "✗ Missing version bump label!" | ||
| echo "" | ||
| echo "This PR modifies plugin files and requires a version bump." | ||
| echo "Please add one of the following labels:" | ||
| echo " - bump:patch (bug fixes: 0.4.1 → 0.4.2)" | ||
| echo " - bump:minor (new features: 0.4.1 → 0.5.0)" | ||
| echo " - bump:major (breaking changes: 0.4.1 → 1.0.0)" | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| name: Version Bump on Label | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [labeled] | ||
|
|
||
| jobs: | ||
| bump-version: | ||
| name: Bump Version | ||
| if: startsWith(github.event.label.name, 'bump:') | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| ref: ${{ github.head_ref }} | ||
|
|
||
| - name: Determine bump type | ||
| id: bump_type | ||
| env: | ||
| LABEL: ${{ github.event.label.name }} | ||
| run: | | ||
| BUMP_TYPE="${LABEL#bump:}" | ||
| echo "type=$BUMP_TYPE" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Find plugin.json | ||
| id: find_plugin | ||
| run: | | ||
| # Look for plugin.json in different locations | ||
| if [ -f "plugin/.claude-plugin/plugin.json" ]; then | ||
| echo "path=plugin/.claude-plugin/plugin.json" >> $GITHUB_OUTPUT | ||
| elif [ -f ".claude-plugin/plugin.json" ]; then | ||
| echo "path=.claude-plugin/plugin.json" >> $GITHUB_OUTPUT | ||
| elif [ -f ".cursor-plugin/plugin.json" ]; then | ||
| echo "path=.cursor-plugin/plugin.json" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "Could not find plugin.json" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Read current version | ||
| id: current_version | ||
| run: | | ||
| PLUGIN_JSON="${{ steps.find_plugin.outputs.path }}" | ||
| VERSION=$(grep -o '"version": *"[^"]*"' "$PLUGIN_JSON" | head -1 | grep -o '[0-9]*\.[0-9]*\.[0-9]*') | ||
| echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
| echo "Current version: $VERSION" | ||
|
|
||
| - name: Calculate new version | ||
| id: new_version | ||
| run: | | ||
| VERSION="${{ steps.current_version.outputs.version }}" | ||
| BUMP_TYPE="${{ steps.bump_type.outputs.type }}" | ||
|
|
||
| IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" | ||
|
|
||
| case "$BUMP_TYPE" in | ||
| major) | ||
| MAJOR=$((MAJOR + 1)) | ||
| MINOR=0 | ||
| PATCH=0 | ||
| ;; | ||
| minor) | ||
| MINOR=$((MINOR + 1)) | ||
| PATCH=0 | ||
| ;; | ||
| patch) | ||
| PATCH=$((PATCH + 1)) | ||
| ;; | ||
| esac | ||
|
|
||
| NEW_VERSION="$MAJOR.$MINOR.$PATCH" | ||
| echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT | ||
| echo "Bumping version: $VERSION → $NEW_VERSION ($BUMP_TYPE)" | ||
|
|
||
| - name: Update version in plugin.json | ||
| run: | | ||
| PLUGIN_JSON="${{ steps.find_plugin.outputs.path }}" | ||
| OLD_VERSION="${{ steps.current_version.outputs.version }}" | ||
| NEW_VERSION="${{ steps.new_version.outputs.version }}" | ||
|
|
||
| sed -i "s/\"version\": *\"$OLD_VERSION\"/\"version\": \"$NEW_VERSION\"/" "$PLUGIN_JSON" | ||
|
|
||
| echo "Updated $PLUGIN_JSON:" | ||
| grep version "$PLUGIN_JSON" | ||
|
|
||
| - name: Update CHANGELOG.md | ||
| env: | ||
| PR_TITLE: ${{ github.event.pull_request.title }} | ||
| run: | | ||
| # Strip the "[Template Sync] " prefix from the PR title to get the description | ||
| DESCRIPTION="${PR_TITLE#\[Template Sync\] }" | ||
| NEW_VERSION="${{ steps.new_version.outputs.version }}" | ||
|
|
||
| if [ -f CHANGELOG.md ]; then | ||
| # Build new file: keep header, insert entry, append rest | ||
| { | ||
| head -1 CHANGELOG.md | ||
| printf '## %s\n%s\n' "$NEW_VERSION" "$DESCRIPTION" | ||
| tail -n +2 CHANGELOG.md | ||
| } > CHANGELOG.tmp | ||
| mv CHANGELOG.tmp CHANGELOG.md | ||
| else | ||
| printf '# Change Log\n\n## %s\n%s\n' "$NEW_VERSION" "$DESCRIPTION" > CHANGELOG.md | ||
| fi | ||
|
|
||
| echo "Updated CHANGELOG.md:" | ||
| head -10 CHANGELOG.md | ||
|
|
||
| - name: Commit version bump | ||
| run: | | ||
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | ||
| git config --local user.name "github-actions[bot]" | ||
| git add . | ||
| git commit -m "chore: bump version to ${{ steps.new_version.outputs.version }}" | ||
| git push |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,10 @@ | ||
| { | ||
| "mcpServers": { | ||
| "semgrep": { | ||
| "command": "semgrep", | ||
| "args": ["mcp"] | ||
| } | ||
| "mcpServers": { | ||
| "semgrep": { | ||
| "command": "semgrep", | ||
| "args": [ | ||
| "mcp" | ||
| ] | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| --- | ||
| name: setup-semgrep-plugin | ||
| description: Set up the Semgrep plugin by installing Semgrep, authenticating, and verifying compatibility | ||
| --- | ||
| # Setup Semgrep Plugin | ||
|
|
||
| Follow these steps to set up the Semgrep plugin: | ||
|
|
||
| ## 1. Install Semgrep | ||
|
|
||
| Check if Semgrep is installed, and install it if not: | ||
|
|
||
| ```bash | ||
| which semgrep || brew install semgrep | ||
| ``` | ||
|
|
||
| ## 2. Authenticate with Semgrep | ||
|
|
||
| Log in to Semgrep (this will open a browser window): | ||
|
|
||
| ```bash | ||
| semgrep login --force | ||
| ``` | ||
|
|
||
| ## 3. Install Semgrep Pro Engine | ||
|
|
||
| Install the Pro engine for enhanced scanning capabilities: | ||
|
|
||
| ```bash | ||
| semgrep install-semgrep-pro || true | ||
| ``` | ||
|
|
||
| ## 4. Verify Installation | ||
|
|
||
| Confirm everything is working: | ||
|
|
||
| ```bash | ||
| semgrep --pro --version | ||
| ``` | ||
|
|
||
| ## 5. Check Version Compatibility | ||
|
|
||
| Verify your Semgrep version is >= 1.146.0: | ||
|
|
||
| ```bash | ||
| semgrep --version | ||
| ``` | ||
|
|
||
| If your version is older than 1.146.0, please update: | ||
| ```bash | ||
| brew upgrade semgrep | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semgrep identified an issue in your code:
Instead of documenting the brew commands you want people to run, you can just commit a Brewfile to the repo and ask that they run
brew bundle.To resolve this comment:
✨ Commit Assistant Fix Suggestion
Brewfilein your repository (if it doesn't already exist).brew "semgrep"to your Brewfile.which semgrep || brew install semgrepin your documentation or setup instructions withbrew bundleorbrew bundle --file=Brewfileif your Brewfile isn't in the root directory.Alternatively, if you want to provide a platform-independent install, consider suggesting
python3 -m pip install semgrepinstead. Using a Brewfile makes it easier to manage and update dependencies for everyone using the repository.💬 Ignore this finding
Reply with Semgrep commands to ignore this finding.
/fp <comment>for false positive/ar <comment>for acceptable risk/other <comment>for all other reasonsAlternatively, triage in Semgrep AppSec Platform to ignore the finding created by use-brewfile.
You can view more details about this finding in the Semgrep AppSec Platform.