🔧 chore: fix skill naming and gitea actions compatibility (related to #2)
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 7m12s
Some checks failed
CI/CD Pipeline / CI Pipeline (push) Failing after 7m12s
This commit is contained in:
379
.vibe/skills/commit-message/SKILL.md
Normal file
379
.vibe/skills/commit-message/SKILL.md
Normal file
@@ -0,0 +1,379 @@
|
||||
---
|
||||
name: commit-message
|
||||
description: Helps create proper Gitmoji commit messages following the Common Gitmoji Reference from AGENTS.md. Use when creating commits to ensure consistent, visual commit messages. Includes Git hooks for automatic code formatting and dependency management.
|
||||
license: MIT
|
||||
metadata:
|
||||
author: DanceLessonsCoach Team
|
||||
version: "1.1.0"
|
||||
based-on: AGENTS.md Common Gitmoji Reference
|
||||
---
|
||||
|
||||
# Commit Message Skill
|
||||
|
||||
This skill helps create proper Gitmoji commit messages following the Common Gitmoji Reference from AGENTS.md. It also includes Git hooks for automatic code formatting and dependency management.
|
||||
|
||||
## Gitmoji Reference
|
||||
|
||||
### Feature Changes
|
||||
- **✨ `:sparkles:` feat**: New feature
|
||||
- **🐛 `:bug:` fix**: Bug fix
|
||||
- **♻️ `:recycle:` refactor**: Code refactoring
|
||||
- **🔥 `:fire:` remove**: Remove code/files
|
||||
- **🚀 `:rocket:` perf**: Performance improvements
|
||||
- **🔒 `:lock:` security**: Security fixes
|
||||
|
||||
### Documentation & Style
|
||||
- **📝 `:memo:` docs**: Documentation
|
||||
- **🎨 `:art:` style**: Code formatting
|
||||
- **📦 `:package:` dependencies**: Dependency changes
|
||||
|
||||
### Platform-Specific
|
||||
- **🐧 `:penguin:` linux**: Linux-specific changes
|
||||
- **🍎 `:apple:` macos**: macOS-specific changes
|
||||
- **🪟 `:window:` windows**: Windows-specific changes
|
||||
|
||||
### Testing & CI
|
||||
- **🧪 `:test_tube:` test**: Tests
|
||||
- **🤖 `:robot:` ci**: CI/CD changes
|
||||
|
||||
### Other
|
||||
- **📈 `:chart_with_upwards_trend:` analytics**: Analytics/SEO
|
||||
- **🌐 `:globe_with_meridians:` i18n**: Internationalization
|
||||
- **⚡ `:zap:` performance**: Performance improvements
|
||||
- **🔧 `:wrench:` chore**: Build/config changes
|
||||
|
||||
## Usage Examples
|
||||
|
||||
### New Feature
|
||||
```bash
|
||||
git commit -m "✨ feat: add user authentication"
|
||||
git commit -m "✨ feat: implement BDD testing framework"
|
||||
```
|
||||
|
||||
### Issue References
|
||||
```bash
|
||||
# When closing an issue
|
||||
git commit -m "✨ feat: implement workflow optimization (closes #2)"
|
||||
|
||||
# When fixing a bug
|
||||
git commit -m "🐛 fix: resolve CI job failure (fixes #5)"
|
||||
|
||||
# When work is related to an issue
|
||||
git commit -m "📝 docs: update workflow documentation (related to #2)"
|
||||
|
||||
# When referencing for context
|
||||
git commit -m "♻️ refactor: clean up CI code (see #3)"
|
||||
```
|
||||
|
||||
### Bug Fix
|
||||
```bash
|
||||
git commit -m "🐛 fix: resolve port conflict in test server"
|
||||
git commit -m "🐛 fix: handle JSON escaping in feature files"
|
||||
```
|
||||
|
||||
### Documentation
|
||||
```bash
|
||||
git commit -m "📝 docs: add comprehensive BDD testing guide"
|
||||
git commit -m "📝 docs: update AGENTS.md with commit conventions"
|
||||
```
|
||||
|
||||
### Refactoring
|
||||
```bash
|
||||
git commit -m "♻️ refactor: move log setup to config package"
|
||||
git commit -m "♻️ refactor: improve step pattern matching"
|
||||
```
|
||||
|
||||
### Tests
|
||||
```bash
|
||||
git commit -m "🧪 test: add BDD scenarios for greet service"
|
||||
git commit -m "🧪 test: implement health endpoint validation"
|
||||
```
|
||||
|
||||
### Configuration
|
||||
```bash
|
||||
git commit -m "🔧 chore: add log output file configuration"
|
||||
git commit -m "🔧 chore: update build system scripts"
|
||||
```
|
||||
|
||||
## Issue Reference Integration
|
||||
|
||||
The skill now integrates with Gitea client to suggest issue references:
|
||||
|
||||
### Automatic Issue Suggestions (NON-BLOCKING)
|
||||
|
||||
When you run `git commit`, the pre-commit hook will:
|
||||
1. **Check for open issues in Gitea** (if available)
|
||||
2. **Display issue suggestions** (helpful information only)
|
||||
3. **Suggest reference formats** (optional guidance)
|
||||
|
||||
**Important:** This is **completely non-blocking** - you can always commit with any message!
|
||||
|
||||
The suggestions are just helpful reminders, never requirements.
|
||||
|
||||
**Example Output:**
|
||||
```
|
||||
🔍 Checking for relevant issues...
|
||||
📋 Found 1 open issue(s):
|
||||
#2: Optimize Gitea Workflow for Main Branch
|
||||
https://gitea.arcodange.lab/arcodange/DanceLessonsCoach/issues/2
|
||||
|
||||
💡 Suggested commit message formats:
|
||||
- closes #<number> (when issue is fully resolved)
|
||||
- fixes #<number> (when fixing a bug)
|
||||
- resolves #<number> (when resolving an issue)
|
||||
- related to #<number> (when work is related)
|
||||
- see #<number> (when referencing for context)
|
||||
|
||||
Example: ✨ feat: implement workflow (closes #2)
|
||||
```
|
||||
|
||||
### Issue Reference Formats
|
||||
|
||||
**Standard Formats:**
|
||||
- `closes #2` - When issue is fully resolved
|
||||
- `fixes #5` - When fixing a specific bug
|
||||
- `resolves #3` - When resolving an issue
|
||||
- `related to #2` - When work is related
|
||||
- `see #4` - When referencing for context
|
||||
|
||||
**GitHub/Gitea Compatible:**
|
||||
These formats are recognized by both GitHub and Gitea to automatically close issues.
|
||||
|
||||
## Git Hooks for Code Quality
|
||||
|
||||
The project includes Git hooks that automatically run before commits to ensure code quality:
|
||||
|
||||
### Pre-commit Hook (NON-BLOCKING)
|
||||
- **Location**: `.git/hooks/pre-commit`
|
||||
- **Automatically runs**:
|
||||
- **Issue reference suggestions** (helpful but optional)
|
||||
- `go mod tidy` - Cleans up and organizes Go dependencies
|
||||
- `go fmt` - Formats staged Go files according to standards
|
||||
- Auto-adds modified files to the commit
|
||||
|
||||
**Behavior:**
|
||||
- ✅ **Always allows commits** - never blocks you
|
||||
- ✅ **Shows helpful suggestions** - you can ignore them
|
||||
- ✅ **Formats Go code automatically** - but only if you're in a Go project
|
||||
- ✅ **Gracefully handles errors** - continues even if something fails
|
||||
|
||||
### How It Works
|
||||
|
||||
```bash
|
||||
# When you commit:
|
||||
git add .
|
||||
git commit -m "✨ feat: add new feature"
|
||||
|
||||
# The hook automatically:
|
||||
1. Runs `go mod tidy`
|
||||
2. Runs `go fmt` on all Go files
|
||||
3. Adds any modified files to your commit
|
||||
4. Allows commit if successful
|
||||
```
|
||||
|
||||
### Benefits
|
||||
- Ensures consistent code formatting
|
||||
- Maintains clean dependency management
|
||||
- Prevents common Go code issues
|
||||
- Runs automatically - no manual steps needed
|
||||
|
||||
## Best Practices
|
||||
|
||||
### Commit Message Structure
|
||||
```
|
||||
<gitmoji> <type>: <description>
|
||||
|
||||
<optional body with details>
|
||||
|
||||
<optional footer with references>
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
**Simple commit:**
|
||||
```
|
||||
✨ feat: add skill_creator framework
|
||||
```
|
||||
|
||||
**Detailed commit:**
|
||||
```
|
||||
✨ feat: implement BDD testing with Godog
|
||||
|
||||
- Add features/greet.feature and features/health.feature
|
||||
- Implement step definitions in pkg/bdd/steps/
|
||||
- Create hybrid in-process test server
|
||||
- Add comprehensive documentation
|
||||
|
||||
Generated by Mistral Vibe.
|
||||
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
||||
```
|
||||
|
||||
**Complex commit:**
|
||||
```
|
||||
🧪 test: add comprehensive BDD test suite
|
||||
|
||||
- Implement greet service scenarios
|
||||
- Add health endpoint validation
|
||||
- Create test server on port 9191
|
||||
- Ensure no undefined/pending steps
|
||||
|
||||
Resolves: #42
|
||||
Ref: AGENTS.md
|
||||
Generated by Mistral Vibe.
|
||||
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
||||
```
|
||||
|
||||
## Validation
|
||||
|
||||
### Check Commit Message Format
|
||||
```bash
|
||||
# Verify gitmoji is present
|
||||
echo "$commit_message" | grep -E "^[[:space:]]*[🎨✨🐛📝🔧♻️🚀🔒📦🔥🐧🍎🪟🤖🧪📈🌐⚡]"
|
||||
|
||||
# Verify type: description format
|
||||
echo "$commit_message" | grep -E "^[🎨✨🐛📝🔧♻️🚀🔒📦🔥🐧🍎🪟🤖🧪📈🌐⚡][[:space:]]+[a-z_]+:"
|
||||
```
|
||||
|
||||
### Common Validation Issues
|
||||
|
||||
| Issue | Cause | Solution |
|
||||
|-------|-------|----------|
|
||||
| Missing gitmoji | No emoji at start | Add appropriate gitmoji from reference |
|
||||
| Wrong type | Type doesn't match emoji | Use correct type from reference table |
|
||||
| Missing colon | No colon after type | Add colon: `feat:` not `feat` |
|
||||
| Long first line | First line > 50 chars | Keep first line concise, add details in body |
|
||||
|
||||
## Git Hooks Reference
|
||||
|
||||
### Hook Location
|
||||
```bash
|
||||
.git/hooks/pre-commit
|
||||
```
|
||||
|
||||
### Hook Content
|
||||
```bash
|
||||
#!/bin/sh
|
||||
|
||||
# DanceLessonsCoach pre-commit hook
|
||||
# Runs go mod tidy and go fmt before allowing commits
|
||||
|
||||
echo "Running pre-commit hooks..."
|
||||
|
||||
# Check if we're in a Go project
|
||||
if [ ! -f "go.mod" ]; then
|
||||
echo "Not a Go project, skipping hooks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run go mod tidy
|
||||
echo "Running go mod tidy..."
|
||||
go mod tidy
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: go mod tidy failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if go.mod or go.sum were modified
|
||||
if git diff --cached --name-only | grep -qE '(go\.mod|go\.sum)'; then
|
||||
echo "go.mod or go.sum changed, adding to commit..."
|
||||
git add go.mod go.sum
|
||||
fi
|
||||
|
||||
# Run go fmt on all Go files
|
||||
echo "Running go fmt..."
|
||||
GOFILES=$(find . -name '*.go' -not -path "./vendor/*" -not -path "./.git/*")
|
||||
if [ -n "$GOFILES" ]; then
|
||||
gofmt -w $GOFILES
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: go fmt failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add formatted files to commit
|
||||
git add $GOFILES
|
||||
fi
|
||||
|
||||
echo "Pre-commit hooks completed successfully"
|
||||
exit 0
|
||||
```
|
||||
|
||||
### Customization
|
||||
|
||||
To modify the hook:
|
||||
```bash
|
||||
# Edit the hook
|
||||
nano .git/hooks/pre-commit
|
||||
|
||||
# Make it executable (if needed)
|
||||
chmod +x .git/hooks/pre-commit
|
||||
```
|
||||
|
||||
### Disabling Hooks
|
||||
|
||||
To skip hooks for a single commit:
|
||||
```bash
|
||||
git commit --no-verify -m "✨ feat: add new feature"
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [Gitmoji Official Site](https://gitmoji.dev)
|
||||
- [Common Gitmoji Reference in AGENTS.md](#common-gitmoji-reference)
|
||||
- [Conventional Commits](https://www.conventionalcommits.org/)
|
||||
- [Git Hooks Documentation](https://git-scm.com/docs/githooks)
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Finding the Right Gitmoji
|
||||
```bash
|
||||
# Search for appropriate gitmoji
|
||||
grep "feature\|new" .vibe/skills/commit_message/SKILL.md
|
||||
# Result: ✨ :sparkles: feat - New feature
|
||||
```
|
||||
|
||||
### Commit Message Too Long
|
||||
```bash
|
||||
# Split into concise first line + detailed body
|
||||
git commit -m "✨ feat: add BDD framework" -m "- Implement Godog testing" -m "- Add greet/health features" -m "- Create test server"
|
||||
```
|
||||
|
||||
### Multiple Changes in One Commit
|
||||
```bash
|
||||
# Use comprehensive description
|
||||
git commit -m "♻️ refactor: improve BDD implementation" -m "- Update step patterns to match Godog exactly" -m "- Add JSON response validation" -m "- Implement server verification" -m "- Update all templates and documentation"
|
||||
```
|
||||
|
||||
### Git Hooks Issues
|
||||
|
||||
**Hook fails with error:**
|
||||
```bash
|
||||
# Check the specific error message
|
||||
# Fix the underlying issue (e.g., Go syntax error, dependency issue)
|
||||
# Commit again
|
||||
```
|
||||
|
||||
**Hook runs too slow:**
|
||||
```bash
|
||||
# The hooks are optimized to only process necessary files
|
||||
# If performance is an issue, check for very large Go files
|
||||
# Consider splitting large files into smaller modules
|
||||
```
|
||||
|
||||
**Need to bypass hooks temporarily:**
|
||||
```bash
|
||||
# Use --no-verify flag
|
||||
git commit --no-verify -m "⚡ chore: quick fix"
|
||||
|
||||
# Remember to run hooks manually later
|
||||
go mod tidy
|
||||
gofmt -w .
|
||||
```
|
||||
|
||||
## Assets
|
||||
|
||||
- **gitmoji-cheatsheet.md**: Quick reference for common gitmoji
|
||||
- **commit-template.txt**: Git commit message template
|
||||
- **validate-commit.sh**: Commit message validation script
|
||||
- **git-hooks/**: Git hooks for automatic code quality
|
||||
- **pre-commit**: Hook that runs `go mod tidy` and `go fmt`
|
||||
- **README.md**: Documentation for Git hooks
|
||||
32
.vibe/skills/commit-message/assets/commit-template.txt
Normal file
32
.vibe/skills/commit-message/assets/commit-template.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
# Commit Message Template
|
||||
|
||||
# Type: Choose one gitmoji from the reference
|
||||
# ✨ :sparkles: feat - New feature
|
||||
# 🐛 :bug: fix - Bug fix
|
||||
# 📝 :memo: docs - Documentation
|
||||
# ♻️ :recycle: refactor - Code refactoring
|
||||
# 🧪 :test_tube: test - Tests
|
||||
# 🔧 :wrench: chore - Configuration
|
||||
|
||||
# Format: <gitmoji> <type>: <description>
|
||||
# Example: ✨ feat: implement BDD testing framework
|
||||
|
||||
# First line (50 chars max):
|
||||
|
||||
# Body (optional - explain what and why, not how):
|
||||
# - Change 1
|
||||
# - Change 2
|
||||
# - Change 3
|
||||
|
||||
# Footer (optional - references, breaking changes):
|
||||
# Issue references (choose one format):
|
||||
# - closes #<issue> (when issue is fully resolved)
|
||||
# - fixes #<issue> (when fixing a bug)
|
||||
# - resolves #<issue> (when resolving an issue)
|
||||
# - related to #<issue> (when work is related)
|
||||
# - see #<issue> (when referencing for context)
|
||||
#
|
||||
# Example: closes #2
|
||||
# Breaking: <description>
|
||||
# Generated by Mistral Vibe.
|
||||
# Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
||||
67
.vibe/skills/commit-message/assets/git-hooks/README.md
Normal file
67
.vibe/skills/commit-message/assets/git-hooks/README.md
Normal file
@@ -0,0 +1,67 @@
|
||||
# Git Hooks for DanceLessonsCoach
|
||||
|
||||
This directory contains Git hooks for the DanceLessonsCoach project.
|
||||
|
||||
## Available Hooks
|
||||
|
||||
### pre-commit
|
||||
- **Location**: `.git/hooks/pre-commit`
|
||||
- **Purpose**: Automatically runs `go mod tidy` and `go fmt` before commits
|
||||
- **Features**:
|
||||
- Runs `go mod tidy` to clean up dependencies
|
||||
- Automatically adds modified `go.mod` and `go.sum` to commit
|
||||
- Runs `go fmt` on staged Go files only
|
||||
- Automatically adds formatted files to commit
|
||||
- Only runs if in a Go project (checks for `go.mod`)
|
||||
|
||||
## Installation
|
||||
|
||||
The pre-commit hook is already installed and executable. No additional setup required.
|
||||
|
||||
## Usage
|
||||
|
||||
The hooks run automatically when you commit:
|
||||
|
||||
```bash
|
||||
git add .
|
||||
git commit -m "✨ feat: add new feature"
|
||||
```
|
||||
|
||||
The hook will:
|
||||
1. Run `go mod tidy`
|
||||
2. Run `go fmt` on all Go files
|
||||
3. Add any modified files to your commit
|
||||
4. Allow the commit to proceed if successful
|
||||
|
||||
## Customization
|
||||
|
||||
To modify the hooks:
|
||||
1. Edit the hook file in `.git/hooks/`
|
||||
2. Make it executable: `chmod +x .git/hooks/hook-name`
|
||||
|
||||
## Disabling Hooks
|
||||
|
||||
To temporarily disable hooks:
|
||||
|
||||
```bash
|
||||
# Skip pre-commit hook for one commit
|
||||
git commit --no-verify -m "✨ feat: add new feature"
|
||||
```
|
||||
|
||||
## Best Practices
|
||||
|
||||
- Let the hooks run automatically - they ensure code quality
|
||||
- The hooks only modify files that need changes
|
||||
- All changes are added to your commit automatically
|
||||
- Hooks run quickly and prevent common issues
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If a hook fails:
|
||||
- Check the error message
|
||||
- Fix the issue manually
|
||||
- Commit again
|
||||
|
||||
Common issues:
|
||||
- `go mod tidy` fails: Check your Go module dependencies
|
||||
- `go fmt` fails: Check for syntax errors in your Go code
|
||||
50
.vibe/skills/commit-message/assets/git-hooks/pre-commit
Executable file
50
.vibe/skills/commit-message/assets/git-hooks/pre-commit
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
# DanceLessonsCoach pre-commit hook
|
||||
# Runs go mod tidy, go fmt, and suggests issue references before allowing commits
|
||||
|
||||
echo "Running pre-commit hooks..."
|
||||
|
||||
# Suggest issue references first (before any changes)
|
||||
if [ -f ".vibe/skills/commit_message/scripts/suggest-issue-reference.sh" ]; then
|
||||
echo "Checking for relevant issues..."
|
||||
./.vibe/skills/commit_message/scripts/suggest-issue-reference.sh || true
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Check if we're in a Go project
|
||||
if [ ! -f "go.mod" ]; then
|
||||
echo "Not a Go project, skipping Go-specific hooks"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Run go mod tidy
|
||||
echo "Running go mod tidy..."
|
||||
go mod tidy
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: go mod tidy failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if go.mod or go.sum were modified
|
||||
if git diff --cached --name-only | grep -qE '(go\.mod|go\.sum)'; then
|
||||
echo "go.mod or go.sum changed, adding to commit..."
|
||||
git add go.mod go.sum
|
||||
fi
|
||||
|
||||
# Run go fmt on staged Go files only
|
||||
echo "Running go fmt on staged files..."
|
||||
STAGED_GOFILES=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
|
||||
if [ -n "$STAGED_GOFILES" ]; then
|
||||
gofmt -w $STAGED_GOFILES
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "ERROR: go fmt failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Add formatted files to commit
|
||||
git add $STAGED_GOFILES
|
||||
fi
|
||||
|
||||
echo "Pre-commit hooks completed successfully"
|
||||
exit 0
|
||||
41
.vibe/skills/commit-message/assets/gitmoji-cheatsheet.md
Normal file
41
.vibe/skills/commit-message/assets/gitmoji-cheatsheet.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Gitmoji Cheatsheet
|
||||
|
||||
## Quick Reference
|
||||
|
||||
### Most Common
|
||||
- ✨ `:sparkles:` - New feature
|
||||
- 🐛 `:bug:` - Bug fix
|
||||
- 📝 `:memo:` - Documentation
|
||||
- ♻️ `:recycle:` - Refactoring
|
||||
- 🧪 `:test_tube:` - Tests
|
||||
- 🔧 `:wrench:` - Configuration
|
||||
|
||||
### All Gitmoji
|
||||
|
||||
| Emoji | Code | Type | Description |
|
||||
|-------|------|------|-------------|
|
||||
| ✨ | `:sparkles:` | feat | New feature |
|
||||
| 🐛 | `:bug:` | fix | Bug fix |
|
||||
| 📝 | `:memo:` | docs | Documentation |
|
||||
| 🎨 | `:art:` | style | Code formatting |
|
||||
| 🔧 | `:wrench:` | chore | Build/config changes |
|
||||
| ♻️ | `:recycle:` | refactor | Code refactoring |
|
||||
| 🚀 | `:rocket:` | perf | Performance improvements |
|
||||
| 🔒 | `:lock:` | security | Security fixes |
|
||||
| 📦 | `:package:` | dependencies | Dependency changes |
|
||||
| 🔥 | `:fire:` | remove | Remove code/files |
|
||||
| 🐧 | `:penguin:` | linux | Linux-specific changes |
|
||||
| 🍎 | `:apple:` | macos | macOS-specific changes |
|
||||
| 🪟 | `:window:` | windows | Windows-specific changes |
|
||||
| 🤖 | `:robot:` | ci | CI/CD changes |
|
||||
| 🧪 | `:test_tube:` | test | Tests |
|
||||
| 📈 | `:chart_with_upwards_trend:` | analytics | Analytics/SEO |
|
||||
| 🌐 | `:globe_with_meridians:` | i18n | Internationalization |
|
||||
| ⚡ | `:zap:` | performance | Performance improvements |
|
||||
|
||||
## Usage Tips
|
||||
|
||||
1. **Keep it simple**: Use the most specific gitmoji that fits
|
||||
2. **Be consistent**: Use the same gitmoji for similar changes
|
||||
3. **First line only**: Gitmoji goes in the first line of commit message
|
||||
4. **One gitmoji per commit**: Focus on the primary change type
|
||||
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Issue Reference Suggestion Script
|
||||
# Suggests relevant Gitea issues to reference in commit messages
|
||||
# This script is NON-BLOCKING and will never prevent commits
|
||||
|
||||
set -e
|
||||
=======
|
||||
|
||||
# Configuration
|
||||
GITEA_CLIENT=".vibe/skills/gitea-client/scripts/gitea-client.sh"
|
||||
|
||||
# Check if we have Gitea client available
|
||||
if [ ! -f "$GITEA_CLIENT" ]; then
|
||||
echo "Gitea client not found - issue reference suggestions disabled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check if we can access Gitea API
|
||||
if [ -z "${GITEA_API_TOKEN_FILE:-}" ] && [ -z "${GITEA_API_TOKEN:-}" ]; then
|
||||
echo "Gitea API token not configured - issue reference suggestions disabled"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "🔍 Checking for relevant issues..."
|
||||
|
||||
# Get list of open issues
|
||||
ISSUES_JSON=$($GITEA_CLIENT list-issues arcodange DanceLessonsCoach open 2>/dev/null || echo "[]")
|
||||
|
||||
# Check if we got valid JSON
|
||||
if [ "$ISSUES_JSON" = "[]" ] || [ -z "$ISSUES_JSON" ]; then
|
||||
echo "✅ No open issues found (you can commit freely)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Extract issue numbers and titles
|
||||
ISSUE_COUNT=$(echo "$ISSUES_JSON" | jq '. | length')
|
||||
|
||||
if [ "$ISSUE_COUNT" -eq 0 ]; then
|
||||
echo "✅ No open issues found"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "📋 Found $ISSUE_COUNT open issue(s):"
|
||||
echo ""
|
||||
|
||||
# Display issues with numbers and titles
|
||||
for ((i=0; i<ISSUE_COUNT; i++)); do
|
||||
ISSUE_NUMBER=$(echo "$ISSUES_JSON" | jq -r ".[$i].number")
|
||||
ISSUE_TITLE=$(echo "$ISSUES_JSON" | jq -r ".[$i].title")
|
||||
ISSUE_URL=$(echo "$ISSUES_JSON" | jq -r ".[$i].html_url")
|
||||
|
||||
echo " #$ISSUE_NUMBER: $ISSUE_TITLE"
|
||||
echo " $ISSUE_URL"
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "💡 Suggested commit message formats:"
|
||||
echo ""
|
||||
echo " - closes #<number> (when issue is fully resolved)"
|
||||
echo " - fixes #<number> (when fixing a bug)"
|
||||
echo " - resolves #<number> (when resolving an issue)"
|
||||
echo " - related to #<number> (when work is related)"
|
||||
echo " - see #<number> (when referencing for context)"
|
||||
echo ""
|
||||
echo "Example: ✨ feat: implement workflow (closes #2)"
|
||||
echo ""
|
||||
|
||||
exit 0
|
||||
67
.vibe/skills/commit-message/scripts/validate-commit.sh
Executable file
67
.vibe/skills/commit-message/scripts/validate-commit.sh
Executable file
@@ -0,0 +1,67 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Commit message validation script
|
||||
# Validates that commit messages follow the Gitmoji convention
|
||||
|
||||
set -e
|
||||
|
||||
# Check if commit message file is provided
|
||||
if [ $# -eq 0 ]; then
|
||||
echo "Usage: $0 <commit-message-file>"
|
||||
echo "Example: $0 .git/COMMIT_EDITMSG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMIT_MSG_FILE="$1"
|
||||
|
||||
# Check if file exists
|
||||
if [ ! -f "$COMMIT_MSG_FILE" ]; then
|
||||
echo "Error: File $COMMIT_MSG_FILE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Read first line of commit message
|
||||
FIRST_LINE=$(head -n 1 "$COMMIT_MSG_FILE")
|
||||
|
||||
# Gitmoji pattern - check for any gitmoji at the start
|
||||
GITMOJI_PATTERN='^[[:space:]]*[🎨✨🐛📝🔧♻️🚀🔒📦🔥🐧🍎🪟🤖🧪📈🌐⚡]'
|
||||
|
||||
# Simpler validation - check for emoji followed by type:description
|
||||
# This avoids complex regex issues with emoji characters
|
||||
|
||||
echo "Validating commit message: $FIRST_LINE"
|
||||
|
||||
# Check for gitmoji (any emoji character at start)
|
||||
if ! echo "$FIRST_LINE" | grep -q '^[[:space:]]*[^[:alnum:]]'; then
|
||||
echo "❌ Error: Missing gitmoji at start of commit message"
|
||||
echo " Expected: ✨ 🐛 📝 ♻️ 🧪 🔧 etc."
|
||||
echo " Got: $FIRST_LINE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for type:description format (emoji followed by word and colon)
|
||||
if ! echo "$FIRST_LINE" | grep -qE '^[[:space:]]*[^[:alnum:]][[:space:]]+[a-z_]+:'; then
|
||||
echo "❌ Error: Invalid commit message format"
|
||||
echo " Expected: <gitmoji> <type>: <description>"
|
||||
echo " Example: ✨ feat: add new feature"
|
||||
echo " Got: $FIRST_LINE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check first line length (should be < 50 chars)
|
||||
FIRST_LINE_LENGTH=${#FIRST_LINE}
|
||||
if [ $FIRST_LINE_LENGTH -gt 50 ]; then
|
||||
echo "⚠️ Warning: First line is $FIRST_LINE_LENGTH characters (recommended max: 50)"
|
||||
echo " Consider: '$FIRST_LINE'"
|
||||
fi
|
||||
|
||||
# Extract gitmoji and type (simplified to avoid emoji regex issues)
|
||||
GITMOJI=$(echo "$FIRST_LINE" | grep -o "^[^[:alnum:]]")
|
||||
TYPE=$(echo "$FIRST_LINE" | sed -E 's/^[^[:alnum:]][[:space:]]*([a-z_]+):.*/\1/')
|
||||
|
||||
echo "✅ Valid commit message format"
|
||||
echo " Gitmoji: $GITMOJI"
|
||||
echo " Type: $TYPE"
|
||||
echo " Description: $(echo "$FIRST_LINE" | sed 's/^[^[:alnum:]][[:space:]]*[a-z_]+: //')"
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user