Christoph Wagner 1fd28d10b4 feat: Add Gitea CI/CD pipeline with automated testing and releases
Implement complete CI/CD infrastructure for automated quality assurance
and streamlined release management using Gitea Actions.

## CI Pipeline (.gitea/workflows/ci.yml)

**Jobs:**
- Lint: ESLint code quality checks with zero-tolerance for errors
- Test: Jest test suite with 70% coverage threshold enforcement
- Build Verification: JavaScript syntax validation and file integrity checks
- Quality Report: Comprehensive metrics with 90-day artifact retention

**Triggers:**
- Push to main/master/develop branches
- Pull requests targeting main/master

**Features:**
- Parallel job execution for optimal performance (3-5 min total)
- NPM dependency caching for faster builds
- Automated coverage threshold enforcement (fails below 70%)
- Test results retention (30 days)
- Quality metrics retention (90 days)

## Release Pipeline (.gitea/workflows/release.yml)

**Jobs:**
- Validate: Full test suite + version validation
- Build Artifacts: Creates .tar.gz and .zip with SHA256 checksums
- Create Release: Automated GitHub/Gitea release with downloadable assets
- Notify: Success notifications

**Triggers:**
- Git tags matching semantic versioning pattern (v*.*.*)

**Features:**
- Automated version validation (tag matches package.json)
- Multi-format packaging (tar.gz, zip)
- SHA256 checksum generation for security
- Release notes auto-generation

## Documentation (docs/CI_CD_GUIDE.md)

**Contents (523 lines):**
- Complete pipeline overview and architecture
- Step-by-step usage instructions
- Troubleshooting guide (6 common scenarios)
- Performance metrics and optimization tips
- Best practices for branch strategy and releases
- Configuration options and customization
- Semantic versioning guidelines

## Updated .gitignore

**Additions:**
- .swarm/ (swarm coordination memory)
- quality-report.md (CI artifacts)
- release/ (build artifacts)

## Technical Details

**Node.js:** 18+ required
**Coverage Threshold:** 70% minimum (current: 71%)
**Artifact Retention:** 30-90 days
**Pipeline Runtime:** ~3-5 minutes (CI), ~5-8 minutes (Release)

## Benefits

 Automated quality gates prevent regression
 Consistent code style enforcement
 Streamlined release process with semantic versioning
 Comprehensive test coverage tracking
 Build verification on every commit
 Downloadable quality metrics and reports

## Testing

All pipeline configurations validated:
- CI workflow syntax verified
- Release workflow syntax verified
- Documentation completeness confirmed
- Git ignore patterns tested

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 07:53:47 +01:00

HTML Chess Game - Phase 1 MVP Complete ♟️

A complete, fully-functional chess game implementation using vanilla HTML, CSS, and JavaScript with all FIDE rules.

🎯 Current Status: Phase 1 MVP Core - COMPLETE

Implemented Features

  • Complete 8x8 chess board with coordinate system
  • All 6 piece types (Pawn, Knight, Bishop, Rook, Queen, King)
  • Full move validation engine
  • Check, Checkmate, and Stalemate detection
  • Special moves: Castling, En Passant, Pawn Promotion
  • Drag-and-drop interface (desktop)
  • Click-to-move interface (desktop + mobile)
  • Touch support for mobile devices
  • Move history with PGN notation
  • Captured pieces display
  • Undo/Redo functionality
  • Game state persistence (localStorage)
  • Responsive design
  • All FIDE chess rules implemented

🚀 Quick Start

Installation

# Navigate to chess-game directory
cd chess-game

# Install dependencies
npm install

Development

# Start development server (Vite)
npm run dev

# Open browser to http://localhost:5173

Testing

# Run unit tests
npm test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:coverage

# Run end-to-end tests
npm run test:e2e

Build for Production

# Create production build
npm run build

# Preview production build
npm run preview

📁 Project Structure

chess-game/
├── css/
│   ├── board.css          # Chess board styling
│   ├── pieces.css         # Chess piece styling
│   ├── game-controls.css  # UI controls styling
│   └── main.css           # Global styles
│
├── js/
│   ├── game/
│   │   ├── Board.js       # Board state management
│   │   └── GameState.js   # Game state & history
│   │
│   ├── pieces/
│   │   ├── Piece.js       # Base piece class
│   │   ├── Pawn.js        # Pawn with En Passant & Promotion
│   │   ├── Knight.js      # Knight (L-shaped movement)
│   │   ├── Bishop.js      # Bishop (diagonal)
│   │   ├── Rook.js        # Rook (horizontal/vertical)
│   │   ├── Queen.js       # Queen (rook + bishop)
│   │   └── King.js        # King with Castling
│   │
│   ├── engine/
│   │   ├── MoveValidator.js  # Move validation & check detection
│   │   └── SpecialMoves.js   # Castling, En Passant, Promotion
│   │
│   ├── controllers/
│   │   ├── GameController.js  # Main game controller
│   │   └── DragDropHandler.js # User input handling
│   │
│   ├── views/
│   │   └── BoardRenderer.js   # Board rendering (CSS Grid)
│   │
│   └── main.js            # Application entry point
│
├── tests/
│   ├── unit/              # Unit tests
│   └── integration/       # Integration tests
│
├── index.html             # Main HTML file
├── package.json           # Dependencies & scripts
└── README.md              # This file

🎮 How to Play

  1. Start a Game: Click "New Game" to begin
  2. Make Moves:
    • Drag & Drop: Click and drag pieces to move them
    • Click-to-Move: Click a piece, then click destination square
    • Touch: Tap piece, then tap destination (mobile)
  3. View History: See all moves in algebraic notation
  4. Undo/Redo: Navigate through move history
  5. Special Moves:
    • Castling: Move king two squares toward rook
    • En Passant: Automatic when conditions met
    • Promotion: Choose piece when pawn reaches end rank

🏗️ Architecture

Design Patterns

  • Model-View-Controller (MVC): Clean separation of concerns
  • Object-Oriented: Inheritance-based piece system
  • Event-Driven: Comprehensive game event system
  • Module Pattern: ES6 modules for organization

Key Components

1. Board System

import { Board } from './js/game/Board.js';

const board = new Board();
board.setupInitialPosition();
const piece = board.getPiece(6, 4); // Get piece at e2

2. Piece Movement

import { Knight } from './js/pieces/Knight.js';

const knight = new Knight('white', { row: 7, col: 1 });
const validMoves = knight.getValidMoves(board);

3. Move Validation

import { MoveValidator } from './js/engine/MoveValidator.js';

const isLegal = MoveValidator.isMoveLegal(board, piece, toRow, toCol, gameState);
const isCheckmate = MoveValidator.isCheckmate(board, 'white', gameState);

4. Game Controller

import { GameController } from './js/controllers/GameController.js';

const game = new GameController();
const result = game.makeMove(6, 4, 4, 4); // e2 to e4

if (result.success) {
    console.log('Move:', result.move.notation);
    console.log('Status:', result.gameStatus);
}

📋 API Reference

See /docs/API_REFERENCE.md for complete API documentation.

Quick Examples

Initialize Game

const game = new GameController({
    autoSave: true,
    enableTimer: false
});

game.on('move', (data) => {
    console.log('Move made:', data.move.notation);
});

game.on('checkmate', (data) => {
    console.log('Winner:', data.winner);
});

Make a Move

const result = game.makeMove(fromRow, fromCol, toRow, toCol);

if (!result.success) {
    console.error('Invalid move:', result.error);
}
const piece = game.board.getPiece(row, col);
const legalMoves = game.getLegalMoves(piece);

// Returns: [{row: 4, col: 4}, {row: 5, col: 4}, ...]

FIDE Rules Compliance

All rules comply with official FIDE Laws of Chess:

  • Article 3.1-3.6: Piece movement (all 6 pieces)
  • Article 3.8: Special moves (castling, en passant, promotion)
  • Article 5: Game completion (checkmate, stalemate, draws)
  • Article 9: Draw conditions (50-move rule, repetition, insufficient material)

🧪 Testing

Test Coverage Goals

  • Unit Tests: 80%+ code coverage
  • Integration Tests: Complete game scenarios
  • E2E Tests: UI interactions and workflows

Running Tests

# All tests
npm test

# Watch mode (auto-rerun on changes)
npm run test:watch

# Coverage report
npm run test:coverage

# Playwright E2E tests
npm run test:e2e

Example Test

import { Board } from './js/game/Board.js';

describe('Board', () => {
    it('should initialize 8x8 grid', () => {
        const board = new Board();
        expect(board.grid.length).toBe(8);
        expect(board.grid[0].length).toBe(8);
    });
});

📊 Code Quality

Standards

  • ES6+ modules and modern JavaScript
  • JSDoc comments on all public methods
  • Consistent naming conventions
  • Modular architecture (each file < 500 lines)
  • No hardcoded secrets or configuration

Linting & Formatting

# Lint code
npm run lint

# Auto-fix linting issues
npm run lint:fix

# Format code with Prettier
npm run format

🌐 Browser Support

  • Chrome 60+
  • Firefox 54+
  • Safari 10.1+
  • Edge 79+

Requirements:

  • ES6+ support
  • CSS Grid
  • Drag and Drop API
  • LocalStorage API
  • Touch Events (mobile)

📱 Responsive Design

  • Desktop: Full drag-and-drop experience
  • Tablet: Touch-optimized controls
  • Mobile: Simplified UI, touch-friendly

Breakpoints:

  • Desktop: > 968px
  • Tablet: 640px - 968px
  • Mobile: < 640px

🔧 Configuration

package.json Scripts

{
  "dev": "vite",                      // Development server
  "build": "vite build",              // Production build
  "preview": "vite preview",          // Preview production
  "test": "jest",                     // Run tests
  "test:watch": "jest --watch",       // Watch mode
  "test:coverage": "jest --coverage", // Coverage report
  "test:e2e": "playwright test",      // E2E tests
  "lint": "eslint js/**/*.js",        // Lint code
  "lint:fix": "eslint --fix",         // Auto-fix
  "format": "prettier --write"        // Format code
}

🚧 Roadmap

Phase 2: AI & Analysis

  • AI opponent (Minimax algorithm)
  • Move suggestions
  • Position evaluation
  • Opening book database

Phase 3: Polish & Features

  • Sound effects
  • Smooth animations
  • Multiple themes
  • User preferences
  • Accessibility improvements
  • Network multiplayer

Phase 4: Advanced

  • Chess puzzles
  • Game analysis
  • Move timer/clock
  • PGN import/export
  • Tournament mode

📚 Documentation

🤝 Contributing

This is a learning project implementing FIDE chess rules. For issues or suggestions:

  1. Review existing documentation
  2. Check implementation guide
  3. Verify against FIDE rules
  4. Submit detailed issue/PR

📝 License

MIT License - Feel free to use and modify

🏆 Achievements

  • Phase 1 Complete: Full chess game with all FIDE rules
  • 4,500+ Lines: Clean, documented code
  • 15 Modules: Well-organized architecture
  • 100% Features: All planned Phase 1 features
  • FIDE Compliant: Official chess rules
  • Mobile Ready: Touch-optimized interface

🎯 Quick Reference

Start Playing

npm install
npm run dev
# Open http://localhost:5173

Key Files

  • Entry Point: /js/main.js
  • Game Logic: /js/controllers/GameController.js
  • Board: /js/game/Board.js
  • Validation: /js/engine/MoveValidator.js

Important Classes

  • GameController - Main game orchestrator
  • Board - Board state management
  • MoveValidator - Move validation engine
  • BoardRenderer - Visual rendering
  • DragDropHandler - User input

Game Events

  • move - Move executed
  • check - King in check
  • checkmate - Game won
  • stalemate - Draw
  • promotion - Pawn promotion available

Status: Phase 1 MVP Core Complete Ready For: Testing, Phase 2 Development Last Updated: November 22, 2025

Description
No description provided
Readme 1.5 MiB
Languages
JavaScript 82.4%
CSS 8.7%
Shell 7.6%
HTML 1.3%