feat: enhance commit message skill with issue reference suggestions (related to #2)
Some checks failed
Go CI/CD Pipeline / Build and Test (push) Successful in 4m26s
Docker Build and Publish / Version Bump (push) Successful in 10m6s
Go CI/CD Pipeline / Lint and Format (push) Successful in 10m33s
Go CI/CD Pipeline / Version Management (push) Successful in 25s
Main Branch CI/CD (Optimized) / Build and Test (push) Failing after 4m2s
Main Branch CI/CD (Optimized) / Lint and Format (push) Successful in 4m41s
Main Branch CI/CD (Optimized) / Version Management and Docker Build (push) Has been skipped
Docker Build and Publish / Build and Push Docker Image (push) Failing after 5m1s

This commit is contained in:
2026-04-06 16:06:25 +02:00
parent d9a981b6d3
commit 7c8c821f66
8 changed files with 736 additions and 152 deletions

View File

@@ -50,6 +50,21 @@ 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"
@@ -80,17 +95,68 @@ 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
### 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

View File

@@ -19,7 +19,14 @@
# - Change 3
# Footer (optional - references, breaking changes):
# Resolves: #<issue>
# 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>

View File

@@ -1,13 +1,20 @@
#!/bin/sh
# DanceLessonsCoach pre-commit hook
# Runs go mod tidy and go fmt before allowing commits
# 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 hooks"
echo "Not a Go project, skipping Go-specific hooks"
exit 0
fi

View File

@@ -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