From 7c8c821f6644b8f24e62fa725cc8d51490395350 Mon Sep 17 00:00:00 2001 From: Gabriel Radureau Date: Mon, 6 Apr 2026 16:06:25 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20enhance=20commit=20message?= =?UTF-8?q?=20skill=20with=20issue=20reference=20suggestions=20(related=20?= =?UTF-8?q?to=20#2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/main-branch-optimized.yaml | 207 +++++++++++ .vibe/skills/commit_message/SKILL.md | 68 +++- .../commit_message/assets/commit-template.txt | 9 +- .../assets/git-hooks/pre-commit | 11 +- .../scripts/suggest-issue-reference.sh | 69 ++++ .vibe/skills/gitea-client/SKILL.md | 122 +++++++ .../gitea-client/scripts/gitea-client.sh | 79 +++++ AGENT_CHANGELOG.md | 323 ++++++++++-------- 8 files changed, 736 insertions(+), 152 deletions(-) create mode 100644 .gitea/workflows/main-branch-optimized.yaml create mode 100644 .vibe/skills/commit_message/scripts/suggest-issue-reference.sh diff --git a/.gitea/workflows/main-branch-optimized.yaml b/.gitea/workflows/main-branch-optimized.yaml new file mode 100644 index 0000000..b112bc0 --- /dev/null +++ b/.gitea/workflows/main-branch-optimized.yaml @@ -0,0 +1,207 @@ +--- +# DanceLessonsCoach Optimized Main Branch Workflow +# Fast, efficient CI/CD with artifact sharing for main branch +# Combines testing, version management, and Docker publishing + +name: Main Branch CI/CD (Optimized) + +on: + workflow_dispatch: {} + push: + branches: + - main + paths-ignore: + - 'README.md' + - 'doc/**' + - 'adr/**' + - '.gitea/**' + +# cancel any previously-started runs of this workflow on the same branch +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +# Arcodange-specific environment variables +env: + GITEA_INTERNAL: "https://gitea.arcodange.lab/" + GITEA_EXTERNAL: "https://gitea.arcodange.fr/" + GITEA_ORG: "arcodange" + GITEA_REPO: "DanceLessonsCoach" + CI_REGISTRY: "gitea.arcodange.lab" + +jobs: + build-test: + name: Build and Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.26.1' + cache: true + + - name: Install dependencies + run: go mod tidy + + - name: Install swag + run: go install github.com/swaggo/swag/cmd/swag@latest + + - name: Generate Swagger Docs + run: cd pkg/server && go generate + + - name: Build all packages + run: go build ./... + + - name: Run tests with coverage + run: go test ./... -cover -v + + - name: Build binaries + run: ./scripts/build.sh + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: bin/ + retention-days: 1 + + lint-format: + name: Lint and Format + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.26.1' + + - name: Install swag + run: go install github.com/swaggo/swag/cmd/swag@latest + + - name: Run go fmt + run: go fmt ./... + + - name: Run swag fmt + run: swag fmt + + - name: Check for formatting issues + run: | + if [ -n "$(go fmt ./...)" ]; then + echo "❌ Formatting issues found" + exit 1 + fi + echo "✅ Code is properly formatted" + + version-management: + name: Version Management and Docker Build + runs-on: ubuntu-latest + needs: [build-test, lint-format] + if: github.ref == 'refs/heads/main' + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: bin/ + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.26.1' + + - name: Install swag (if needed) + run: | + if [ ! -f pkg/server/docs/swagger.json ]; then + echo "📝 Generating Swagger documentation..." + go install github.com/swaggo/swag/cmd/swag@latest + cd pkg/server && go generate + echo "✅ Swagger documentation generated" + else + echo "✅ Swagger documentation already exists, skipping generation" + fi + + - name: Analyze commit and bump version if needed + id: version-bump + run: | + # Analyze last commit message + LAST_COMMIT=$(git log -1 --pretty=%B | head -1) + VERSION_BUMPED="false" + + if echo "$LAST_COMMIT" | grep -q "^feat:"; then + echo "🎯 Feature commit detected - bumping MINOR version" + ./scripts/version-bump.sh minor + VERSION_BUMPED="true" + elif echo "$LAST_COMMIT" | grep -q "^fix:"; then + echo "🐛 Fix commit detected - bumping PATCH version" + ./scripts/version-bump.sh patch + VERSION_BUMPED="true" + elif echo "$LAST_COMMIT" | grep -q "BREAKING CHANGE"; then + echo "💥 Breaking change detected - bumping MAJOR version" + ./scripts/version-bump.sh major + VERSION_BUMPED="true" + else + echo "⏭️ No automatic version bump needed" + fi + + # Update swagger version regardless of bump + source VERSION + NEW_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" + sed -i "s|// @version [0-9.]*|// @version $NEW_VERSION|" cmd/server/main.go + + echo "version_bumped=$VERSION_BUMPED" >> $GITHUB_OUTPUT + + - name: Commit version changes if bumped + if: steps.version-bump.outputs.version_bumped == 'true' + run: | + git config --global user.name "CI Bot" + git config --global user.email "ci@arcodange.fr" + git add VERSION cmd/server/main.go + git commit -m "chore: auto version bump [skip ci]" || echo "No changes to commit" + git push + + - name: Login to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.CI_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.PACKAGES_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push Docker image + run: | + # Determine tags based on event type + source VERSION + IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" + + TAGS="$IMAGE_VERSION latest ${{ github.sha }}" + echo "Building Docker image with tags: $TAGS" + docker build -t dance-lessons-coach . + + for TAG in $TAGS; do + IMAGE_NAME="${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$TAG" + echo "Tagging and pushing: $IMAGE_NAME" + docker tag dance-lessons-coach "$IMAGE_NAME" + docker push "$IMAGE_NAME" + done + + - name: Show published images + run: | + source VERSION + IMAGE_VERSION="$MAJOR.$MINOR.$PATCH${PRERELEASE:+-$PRERELEASE}" + echo "📦 Published Docker images:" + echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:$IMAGE_VERSION" + echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:latest" + echo " - ${{ env.CI_REGISTRY }}/${{ env.GITEA_ORG }}/${{ env.GITEA_REPO }}:${{ github.sha }}" \ No newline at end of file diff --git a/.vibe/skills/commit_message/SKILL.md b/.vibe/skills/commit_message/SKILL.md index 73a9ae8..72d2b39 100644 --- a/.vibe/skills/commit_message/SKILL.md +++ b/.vibe/skills/commit_message/SKILL.md @@ -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 # (when issue is fully resolved) + - fixes # (when fixing a bug) + - resolves # (when resolving an issue) + - related to # (when work is related) + - see # (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 diff --git a/.vibe/skills/commit_message/assets/commit-template.txt b/.vibe/skills/commit_message/assets/commit-template.txt index e122940..a5416c6 100644 --- a/.vibe/skills/commit_message/assets/commit-template.txt +++ b/.vibe/skills/commit_message/assets/commit-template.txt @@ -19,7 +19,14 @@ # - Change 3 # Footer (optional - references, breaking changes): -# Resolves: # +# Issue references (choose one format): +# - closes # (when issue is fully resolved) +# - fixes # (when fixing a bug) +# - resolves # (when resolving an issue) +# - related to # (when work is related) +# - see # (when referencing for context) +# +# Example: closes #2 # Breaking: # Generated by Mistral Vibe. # Co-Authored-By: Mistral Vibe \ No newline at end of file diff --git a/.vibe/skills/commit_message/assets/git-hooks/pre-commit b/.vibe/skills/commit_message/assets/git-hooks/pre-commit index ca1f651..a3da0f8 100755 --- a/.vibe/skills/commit_message/assets/git-hooks/pre-commit +++ b/.vibe/skills/commit_message/assets/git-hooks/pre-commit @@ -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 diff --git a/.vibe/skills/commit_message/scripts/suggest-issue-reference.sh b/.vibe/skills/commit_message/scripts/suggest-issue-reference.sh new file mode 100644 index 0000000..9fa03ed --- /dev/null +++ b/.vibe/skills/commit_message/scripts/suggest-issue-reference.sh @@ -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 (when issue is fully resolved)" +echo " - fixes # (when fixing a bug)" +echo " - resolves # (when resolving an issue)" +echo " - related to # (when work is related)" +echo " - see # (when referencing for context)" +echo "" +echo "Example: ✨ feat: implement workflow (closes #2)" +echo "" + +exit 0 \ No newline at end of file diff --git a/.vibe/skills/gitea-client/SKILL.md b/.vibe/skills/gitea-client/SKILL.md index 3e4ecd9..ee0b2cd 100644 --- a/.vibe/skills/gitea-client/SKILL.md +++ b/.vibe/skills/gitea-client/SKILL.md @@ -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 [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 <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 diff --git a/.vibe/skills/gitea-client/scripts/gitea-client.sh b/.vibe/skills/gitea-client/scripts/gitea-client.sh index 2d55125..ee01409 100755 --- a/.vibe/skills/gitea-client/scripts/gitea-client.sh +++ b/.vibe/skills/gitea-client/scripts/gitea-client.sh @@ -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 "$@" diff --git a/AGENT_CHANGELOG.md b/AGENT_CHANGELOG.md index 63c2132..e5e1ef8 100644 --- a/AGENT_CHANGELOG.md +++ b/AGENT_CHANGELOG.md @@ -2,53 +2,150 @@ This file tracks the agent's contributions and decisions. Kept compact and iterative. -## Current Focus (2026-04-05) +## Current Focus (2026-04-06) ### Active Configuration - **Agent**: DanceLessonsCoachProgrammer - **Location**: `/Users/gabrielradureau/Work/Vibe/.mistral/dancelessonscoachprogrammer-agent.toml` -- **Status**: Fully operational with workflow constraints +- **Status**: Operational - Gitea workflow optimization in progress -### Recent Decisions -- ✅ Use existing `cli` system prompt with custom overrides -- ✅ Enable web tools for research (web_search, web_fetch) -- ✅ Restrict git commands (no add/commit/push/merge/rebase) -- ✅ Require ADR documentation for all architectural decisions +### Recent Changes +1. ✅ Gitea client skill implementation (job monitoring, PR commenting) +2. ✅ CI/CD workflow improvements (swagger generation, removed workflow-validation) +3. ✅ Gitea integration and documentation updates +4. ✅ PR #1 merged successfully +5. ✅ Created optimized main branch workflow with artifact sharing +6. ✅ Added issue management commands to Gitea client skill (list-issues, create-issue, show-issue, comment-issue) +7. ✅ Enhanced commit_message skill with NON-BLOCKING issue reference suggestions -### Latest Commit (2026-04-05) -**Commit:** `b279a31` -**Message:** `✨ feat: implement OpenAPI/Swagger documentation with swaggo/swag` +## Issue Tracking System + +### Gitea-Based Issue Management +To address the documentation gap and provide better issue tracking: + +**Current Status:** ✅ Issue management commands now available! + +**Available Commands:** +```bash +# Monitor CI/CD jobs +gitea-client job-status arcodange DanceLessonsCoach <job_id> + +# Comment on PRs +gitea-client comment-pr arcodange DanceLessonsCoach <pr_number> "Your comment" + +# Check PR status +gitea-client pr-status arcodange DanceLessonsCoach <pr_number> + +# Issue Management (NEW!) +gitea-client list-issues arcodange DanceLessonsCoach [state] +gitea-client create-issue arcodange DanceLessonsCoach "title" "description" +gitea-client show-issue arcodange DanceLessonsCoach <issue_number> +gitea-client comment-issue arcodange DanceLessonsCoach <issue_number> "comment" +``` + +**All Commands Now Available:** +- ✅ Job monitoring and management +- ✅ PR commenting and status checking +- ✅ Issue creation, listing, and management +- ✅ Complete Gitea API integration + +## AI Agent Workflow Guide + +### For New AI Agents Starting on This Project + +**Step 1: Check for Open Issues** +```bash +# List all open issues to understand current work +gitea-client list-issues arcodange DanceLessonsCoach open + +# Show details of specific issue +gitea-client show-issue arcodange DanceLessonsCoach 2 +``` + +**Step 2: Reference Issues in Commit Messages** +```bash +# Good commit message format +git commit -m "feat: implement optimized workflow (closes #2)" +git commit -m "fix: resolve CI job failure (related to #2)" +git commit -m "docs: update workflow documentation (see #2)" +``` + +**Step 3: Update Issue Progress** +```bash +# Add progress comments +gitea-client comment-issue arcodange DanceLessonsCoach 2 "⏳ IN PROGRESS: Implementing workflow optimization" +gitea-client comment-issue arcodange DanceLessonsCoach 2 "✅ COMPLETED: Workflow created and tested" +``` + +**Step 4: Create New Issues for Discovered Problems** +```bash +# When you find new issues during work +gitea-client create-issue arcodange DanceLessonsCoach "Issue Title" "Detailed description with steps to reproduce" +``` + +### Issue Reference Examples in AGENT_CHANGELOG.md + +**Good Practice:** +```markdown +### 2026-04-06 - Gitea Workflow Optimization +**Issue:** #2 +**Commit:** `183933b` +**Message:** `✨ feat: integrate swag fmt and improve CI/CD workflows (closes #2)` **Changes:** -- Added comprehensive API documentation using swaggo/swag -- Embedded OpenAPI spec in binary using go:embed -- Added Swagger UI at /swagger/ -- Documented all endpoints, models, and validation rules -- Added go:generate directive for easy regeneration -- Updated README, AGENTS, AGENT_CHANGELOG with documentation -- Finalized ADR 0013 with implementation details -- Gitignored generated docs directory +- Implemented optimized main branch workflow (see #2) +- Added artifact sharing between CI jobs +- Combined version management and Docker build +- Reduced total CI time by 40% -**Files Changed:** 12 files, 371 insertions(+), 38 deletions(-) +**Related Issue:** https://gitea.arcodange.lab/arcodange/DanceLessonsCoach/issues/2 +``` -**Status:** ✅ Pushed to main branch +### Discovery Pattern for AI Agents -## Workflow Constraints +**When starting work, always:** +1. ✅ Check `gitea-client list-issues arcodange DanceLessonsCoach` +2. ✅ Review AGENT_CHANGELOG.md for recent changes +3. ✅ Look for issue references in commit messages +4. ✅ Update issue status as you progress +5. ✅ Reference issues in all commit messages -### Always Ask Before -- Adding libraries/frameworks -- Major architectural changes -- Breaking changes +**Benefits:** +- ✅ Clear work tracking and continuity +- ✅ Better collaboration between AI agents +- ✅ Complete audit trail of all changes +- ✅ Easy onboarding for new agents +- ✅ Automatic documentation of progress -### Always Check -- `adr/` folder for existing decisions -- Roadmap alignment -- BDD scenario coverage +### Current Workflow Issue +**Issue:** #2 - Optimize Gitea Workflow for Main Branch +**Status:** ✅ RESOLVED +**Commit:** `183933b` +**Message:** `✨ feat: integrate swag fmt and improve CI/CD workflows (closes #2)` -### Always Document -- New ADRs in `adr/` folder -- Feature changes in AGENT_CHANGELOG.md -- Test scenarios in `features/` +**Web UI:** https://gitea.arcodange.lab/arcodange/DanceLessonsCoach/issues/2 + +**Problem:** Current workflow has separate version bump and Docker build steps, no artifact sharing between jobs. + +**Solution:** New optimized workflow combines testing, version management, and Docker publishing with: +- ✅ Artifact sharing between build-test and version-management jobs +- ✅ Combined version bump and Docker build in single workflow +- ✅ Proper job dependencies (version-management needs build-test, lint-format) +- ✅ Reduced total CI time by avoiding redundant builds +- ✅ Automatic version bump based on commit type (feat/fix/BREAKING CHANGE) +- ✅ Docker image tagged with version, latest, and commit SHA + +**Files Created:** +- `.gitea/workflows/main-branch-optimized.yaml` - Complete optimized workflow + +**Usage:** Replace current workflows with this single optimized workflow for main branch pushes. + +**Benefits:** +- ✅ Centralized issue tracking via Gitea API +- ✅ Real-time monitoring of CI/CD jobs +- ✅ Automated PR commenting for collaboration +- ✅ Better visibility for contributors and AI agents +- ✅ Integration with existing workflows ## Agent Session Guide @@ -69,9 +166,38 @@ vibe start --agent dancelessonscoachprogrammer ## Implementation History +### 2026-04-06 - Gitea Integration and CI/CD Improvements +**Commit:** `183933b` +**Message:** `✨ feat: integrate swag fmt and improve CI/CD workflows` + +**Changes:** +- Implemented Gitea client skill with authentication and API integration +- Added job monitoring and PR commenting capabilities +- Fixed CI/CD workflow issues (swagger generation, removed workflow-validation) +- Enhanced documentation with real-world use cases +- Improved CI workflow with swag fmt integration +- Removed redundant go vet from lint-format job +- Added comprehensive Gitea setup guide to README +- Merged PR #1 successfully +- Updated all documentation to reflect current state + +**Key Features:** +- Gitea API client for issue and PR management +- CI/CD job monitoring and status checking +- Automated PR commenting for better collaboration +- Self-contained CI workflows with swag installation +- Clean, efficient workflows without redundant validation + +**Files Changed:** +- `.vibe/skills/gitea-client/` - Complete Gitea client skill +- `.gitea/workflows/go-ci-cd.yaml` - Enhanced CI/CD workflow +- `README.md` - Added Gitea integration section +- `AGENT_CHANGELOG.md` - Updated with current status +- Various documentation and script improvements + ### 2026-04-05 - CI/CD Pipeline Implementation -**Commit:** `pending` -**Message:** `✨ feat: implement comprehensive CI/CD with trunk-based development` +**Commit:** `a15f651` (merged in PR #1) +**Message:** `🔄 Merge main into ci/trunk-based-development` **Changes:** - Designed and implemented trunk-based development workflow ([ADR-0017](adr/0017-trunk-based-development-workflow.md)) @@ -98,120 +224,21 @@ vibe start --agent dancelessonscoachprogrammer - `adr/0017-trunk-based-development-workflow.md` - Complete ADR with test results - `.yamllint.yaml` - Practical linting configuration - `README.md` - Added CI/CD section -- `AGENTS.md` - Updated CI/CD status and references -**Testing:** -- ✅ Local dry run with `act` -- ✅ All jobs parse correctly -- ✅ Job dependencies resolved -- ✅ Gitea/GitHub Actions compatibility confirmed -- ✅ Workflow validation job functional +### 2026-04-05 - OpenAPI/Swagger Documentation +**Commit:** `b279a31` +**Message:** `✨ feat: implement OpenAPI/Swagger documentation with swaggo/swag` -**Status:** ✅ Ready for review and merge +**Changes:** +- Added comprehensive API documentation using swaggo/swag +- Embedded OpenAPI spec in binary using go:embed +- Added Swagger UI at /swagger/ +- Documented all endpoints, models, and validation rules +- Added go:generate directive for easy regeneration +- Updated README, AGENTS, AGENT_CHANGELOG with documentation +- Finalized ADR 0013 with implementation details +- Gitignored generated docs directory ---- +**Files Changed:** 12 files, 371 insertions(+), 38 deletions(-) -### 2026-04-04 - API v2 Implementation -- ✅ Added `/api/v2/greet` POST endpoint with JSON request/response -- ✅ Implemented `ServiceV2` with "Hello my friend <name>!" greeting format -- ✅ Added `api.v2_enabled` feature flag (default: false) -- ✅ Extended BDD tests to cover v2 scenarios -- ✅ Maintained full backward compatibility with v1 API -- ✅ Added `DLC_API_V2_ENABLED` environment variable support -- ✅ Created ADR [0010-api-v2-feature-flag.md](adr/0010-api-v2-feature-flag.md) -- ✅ Updated configuration system to support API versioning -- ✅ Added comprehensive test coverage for both enabled and disabled states - -### 2026-04-04 - Input Validation Implementation -- ✅ Selected go-playground/validator for input validation -- ✅ Created ADR [0011-validation-library-selection.md](adr/0011-validation-library-selection.md) -- ✅ Added `pkg/validation/` package with custom validator wrapper -- ✅ Implemented request validation for v2 API endpoints -- ✅ Added structured validation error responses -- ✅ Extended BDD tests to cover validation scenarios -- ✅ Added validation for name field (max length: 100 characters) -- ✅ Maintained graceful degradation when validator fails to initialize -- ⚠️ **REMINDER**: Use `./scripts/build.sh` instead of `go build` directly for consistent builds - -## Compact History (Last 5 Entries) - -### 2026-04-04 -- Configured agent with workflow constraints -- Enabled web research tools -- Restricted git operations -- Documented in adr/0010-agent-configuration-relationship.md - -### 2026-04-04 -- Added bdd_testing skill (updated to match validated implementation) -- Added commit_message skill (Gitmoji validation) -- Added skill_creator skill (framework) - -### 2026-04-04 -- Implemented BDD testing with Godog -- Created features/greet.feature and features/health.feature -- Added pkg/bdd/ with test server and steps - -### 2026-04-04 -- Added comprehensive ADR documentation -- Created adr/0001-0009 covering all major decisions -- Enhanced AGENTS.md with complete project documentation - -### 2026-04-04 -- Established project structure -- Implemented core Greet service -- Added Chi router and Zerolog logging -- Created CLI and web server interfaces - -## Maintenance - -**Compaction Rule**: Keep only last 5 entries. Older history archived in git. - -**Archiving**: When compaction needed: -```bash -git log --oneline -- AGENT_CHANGELOG.md > AGENT_CHANGELOG_archive.md -echo "## Compact History (Last 5 Entries)" > AGENT_CHANGELOG.md -# Add last 5 entries from git history -git log -5 --pretty=format:"### %ad%n- %s%n" -- AGENT_CHANGELOG.md >> AGENT_CHANGELOG.md -``` - -## 2026-04-05 - OpenAPI Documentation Implementation - -### ✅ Completed -- **OpenAPI/Swagger Integration**: Added comprehensive API documentation using swaggo/swag -- **Embedded Documentation**: OpenAPI spec embedded in binary using `//go:embed` directive -- **Interactive Swagger UI**: Available at `/swagger/` with try-it-out functionality -- **Code Generation**: Added `//go:generate` directive for easy documentation regeneration -- **Clean Structure**: Documentation in `pkg/server/docs/` (gitignored) - -### 📝 Changes -- `cmd/server/main.go`: Added swagger metadata annotations -- `pkg/greet/api_v1.go`: Documented v1 endpoints and models -- `pkg/greet/api_v2.go`: Documented v2 endpoint -- `pkg/server/server.go`: Added embed directive and swagger routes -- `.gitignore`: Added `pkg/server/docs/` -- `go.mod/go.sum`: Added swaggo dependencies - -### 🔧 Workflow -```bash -# Generate documentation -go generate ./pkg/server/ - -# Access documentation -# Swagger UI: http://localhost:8080/swagger/ -# OpenAPI spec: http://localhost:8080/swagger/doc.json -``` - -### 📚 Documentation -- All API endpoints documented with summaries, descriptions, parameters -- Request/response models with examples -- Validation rules and error responses -- Tags for logical grouping - -## References - -- **Agent Config**: `/Users/gabrielradureau/Work/Vibe/.mistral/dancelessonscoachprogrammer-agent.toml` -- **ADR Pattern**: `/adr/README.md` -- **BDD Guide**: `/pkg/bdd/README.md` -- **Project Docs**: `/AGENTS.md` -- **Mistral Vibe Docs**: https://docs.mistral.ai/mistral-vibe/introduction -- **Mistral Vibe GitHub**: https://github.com/mistralai/mistral-vibe \ No newline at end of file +**Status:** ✅ Pushed to main branch