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

View File

@@ -183,6 +183,104 @@ Get the current status of a pull request.
- `repo`: Repository name
- `pr_number`: PR number
### List Issues
```bash
skill gitea-client list-issues <owner> <repo> [state]
```
List issues for a repository.
**Arguments:**
- `owner`: Repository owner
- `repo`: Repository name
- `state`: Issue state (open, closed, all) - default: open
**Examples:**
```bash
# List open issues
gitea-client list-issues arcodange DanceLessonsCoach
# List closed issues
gitea-client list-issues arcodange DanceLessonsCoach closed
# List all issues
gitea-client list-issues arcodange DanceLessonsCoach all
```
### Create Issue
```bash
skill gitea-client create-issue <owner> <repo> <title> <description>
```
Create a new issue in the repository.
**Arguments:**
- `owner`: Repository owner
- `repo`: Repository name
- `title`: Issue title
- `description`: Issue description (use quotes)
**Examples:**
```bash
# Create a simple issue
gitea-client create-issue arcodange DanceLessonsCoach "Bug in CI workflow" "The CI workflow fails on job 350"
# Create detailed issue with multi-line description
gitea-client create-issue arcodange DanceLessonsCoach "Optimize main branch workflow" "Current workflow has separate version bump and Docker build steps. Need to optimize by:
1. Share artifacts between CI jobs for faster execution
2. Combine version management and Docker build in single workflow
3. Use proper job dependencies and artifact caching
4. Reduce total CI time by avoiding redundant builds"
```
### Show Issue Details
```bash
skill gitea-client show-issue <owner> <repo> <issue_number>
```
Get detailed information about a specific issue.
**Arguments:**
- `owner`: Repository owner
- `repo`: Repository name
- `issue_number`: Issue number
**Examples:**
```bash
# Show issue details
gitea-client show-issue arcodange DanceLessonsCoach 42
# Get issue and extract title
gitea-client show-issue arcodange DanceLessonsCoach 42 | jq '.title'
```
### Comment on Issue
```bash
skill gitea-client comment-issue <owner> <repo> <issue_number> <comment>
```
Add a comment to an existing issue.
**Arguments:**
- `owner`: Repository owner
- `repo`: Repository name
- `issue_number`: Issue number
- `comment`: Comment text (use quotes)
**Examples:**
```bash
# Add simple comment
gitea-client comment-issue arcodange DanceLessonsCoach 42 "Working on this now"
# Add detailed update
gitea-client comment-issue arcodange DanceLessonsCoach 42 "Created optimized workflow in .gitea/workflows/main-branch-optimized.yaml. Ready for testing."
```
## Workflows
### Monitor CI/CD Job
@@ -217,6 +315,30 @@ skill gitea-client job-logs owner repo job_id > workflow_logs.txt
skill gitea-client comment-pr owner repo pr_number "Job failed: analysis results"
```
### Issue Management Workflow
```bash
# 1. List open issues
gitea-client list-issues arcodange DanceLessonsCoach
# 2. Create new issue for workflow optimization
gitea-client create-issue arcodange DanceLessonsCoach "Optimize main branch workflow" "Current workflow has separate version bump and Docker build steps. Need to optimize by:
1. Share artifacts between CI jobs for faster execution
2. Combine version management and Docker build in single workflow
3. Use proper job dependencies and artifact caching
4. Reduce total CI time by avoiding redundant builds"
# 3. Show issue details
gitea-client show-issue arcodange DanceLessonsCoach 42
# 4. Add progress comment
gitea-client comment-issue arcodange DanceLessonsCoach 42 "Created optimized workflow in .gitea/workflows/main-branch-optimized.yaml. Ready for testing."
# 5. Close issue when resolved
gitea-client comment-issue arcodange DanceLessonsCoach 42 "✅ RESOLVED: Optimized workflow implemented and tested successfully."
```
### Complete CI Debugging Workflow
```bash

View File

@@ -234,6 +234,10 @@ main() {
wait-job) cmd_wait_job "$@" ;;
comment-pr) cmd_comment_pr "$@" ;;
pr-status) cmd_pr_status "$@" ;;
list-issues) cmd_list_issues "$@" ;;
create-issue) cmd_create_issue "$@" ;;
show-issue) cmd_show_issue "$@" ;;
comment-issue) cmd_comment_issue "$@" ;;
*)
echo "Usage: $0 <command> [args...]" >&2
echo "" >&2
@@ -246,9 +250,84 @@ main() {
echo " wait-job <owner> <repo> <job_id> [timeout]" >&2
echo " comment-pr <owner> <repo> <pr_number> <comment>" >&2
echo " pr-status <owner> <repo> <pr_number>" >&2
echo " list-issues <owner> <repo> [state]" >&2
echo " create-issue <owner> <repo> <title> <description>" >&2
echo " show-issue <owner> <repo> <issue_number>" >&2
echo " comment-issue <owner> <repo> <issue_number> <comment>" >&2
exit 1
;;
esac
}
# List issues
cmd_list_issues() {
local owner="$1"
local repo="$2"
local state="${3:-open}"
if [[ -z "$owner" || -z "$repo" ]]; then
echo "Usage: $0 list-issues <owner> <repo> [state]" >&2
exit 1
fi
local endpoint="/repos/$owner/$repo/issues?state=$state"
api_request "GET" "$endpoint"
}
# Create a new issue
cmd_create_issue() {
local owner="$1"
local repo="$2"
local title="$3"
local description="$4"
if [[ -z "$owner" || -z "$repo" || -z "$title" || -z "$description" ]]; then
echo "Usage: $0 create-issue <owner> <repo> <title> <description>" >&2
exit 1
fi
local endpoint="/repos/$owner/$repo/issues"
local data=$(jq -n --arg title "$title" --arg body "$description" '{
title: $title,
body: $body
}')
api_request "POST" "$endpoint" "$data"
}
# Show issue details
cmd_show_issue() {
local owner="$1"
local repo="$2"
local issue_number="$3"
if [[ -z "$owner" || -z "$repo" || -z "$issue_number" ]]; then
echo "Usage: $0 show-issue <owner> <repo> <issue_number>" >&2
exit 1
fi
local endpoint="/repos/$owner/$repo/issues/$issue_number"
api_request "GET" "$endpoint"
}
# Comment on an issue
cmd_comment_issue() {
local owner="$1"
local repo="$2"
local issue_number="$3"
local comment="$4"
if [[ -z "$owner" || -z "$repo" || -z "$issue_number" || -z "$comment" ]]; then
echo "Usage: $0 comment-issue <owner> <repo> <issue_number> <comment>" >&2
exit 1
fi
local endpoint="/repos/$owner/$repo/issues/$issue_number/comments"
local data=$(jq -n --arg body "$comment" '{
body: $body
}')
api_request "POST" "$endpoint" "$data"
}
main "$@"