Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
92b0f8d
Add complete project scaffolding for ManaMind AI agent
anchapin Aug 8, 2025
258556b
Add GitHub Actions workflow for testing and linting
anchapin Aug 8, 2025
09aebfd
Refactor PolicyValueNetwork and SelfPlayTrainer for improved readabil…
anchapin Aug 8, 2025
d9340af
Fix linting errors and code formatting
anchapin Aug 8, 2025
9315cb4
Fix formatting and linting issues
anchapin Aug 8, 2025
18d73ee
Add pre-commit configuration and update CLAUDE.md with code quality g…
anchapin Aug 8, 2025
934771d
Fix remaining linting and formatting issues
anchapin Aug 8, 2025
9e59b51
Fix formatting configuration and resolve all linting issues
anchapin Aug 8, 2025
f8576ad
Fix remaining black formatting issues and add setup.cfg for flake8
anchapin Aug 8, 2025
0e39de6
Fix major mypy type checking issues
anchapin Aug 8, 2025
09eff51
Fix formatting and linting issues
anchapin Aug 8, 2025
8188cbd
Add return type annotations to CLI functions
anchapin Aug 8, 2025
b469865
Fix major mypy type checking errors
anchapin Aug 8, 2025
20b83ba
Fix core module mypy type checking errors
anchapin Aug 8, 2025
687f9b1
Fix missing Any import in agent.py
anchapin Aug 8, 2025
ba3d109
Fix black formatting and import issues
anchapin Aug 8, 2025
64d023c
Add CI diagnostics report, local CI check script, and act configuration
anchapin Aug 8, 2025
1f606a8
Fix MyPy type checking errors and CI failures\n\n- Fixed missing type…
anchapin Aug 8, 2025
3f513ad
Add GEMINI.md with comprehensive project documentation for AI context
anchapin Aug 8, 2025
3bf908e
Update Codecov action to v5 and ensure token is set for coverage upload
anchapin Aug 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .actrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Act configuration for local GitHub Actions testing
# This file optimizes 'act' performance and behavior

# Use smaller, faster images when possible
-P ubuntu-latest=catthehacker/ubuntu:act-latest
-P ubuntu-22.04=catthehacker/ubuntu:act-22.04
-P ubuntu-20.04=catthehacker/ubuntu:act-20.04

# Speed up builds by reusing images
--reuse

# Show more helpful output
--verbose

# Don't rebuild containers unnecessarily
--use-gitignore

# Platform settings for consistency
--platform linux/amd64
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Test Suite

on:
pull_request:
branches: [main]
push:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"

- name: Run linting
run: |
black --check src tests
isort --check-only src tests
flake8 src tests

- name: Run type checking
run: mypy src

- name: Run tests
run: |
pytest --cov=src/manamind --cov-report=xml --cov-report=term-missing -v

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
if: matrix.python-version == '3.11'
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
fail_ci_if_error: true
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
args: [--line-length=79]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile=black, --line-length=79]

- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.1
hooks:
- id: mypy
additional_dependencies: [types-all]
args: [--ignore-missing-imports]
84 changes: 82 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,29 @@ ManaMind is an AI agent designed to play Magic: The Gathering (MTG) at a superhu

## Development Commands

*Note: This project is in early planning phase. Commands will be added as the codebase develops.*
### Code Quality & Formatting (CRITICAL)
Always run these commands before committing to prevent CI failures:
```bash
# Format code with black (79 character limit to match CI)
black --line-length 79 src tests

# Sort imports
isort src tests

# Check for linting issues
flake8 src tests

# Type checking
mypy src

Expected future commands:
# Run tests with coverage
pytest --cov=src/manamind --cov-report=xml --cov-report=term-missing -v

# Run all quality checks at once (recommended before commit)
black --line-length 79 src tests && isort src tests && flake8 src tests && mypy src
```

### Training Commands (Future)
```bash
# Training commands (future)
python train.py --config configs/base.yaml
Expand All @@ -84,6 +104,66 @@ python mtga_interface.py --test-mode

## Development Guidelines

### Code Quality Standards (MANDATORY)
**CRITICAL: Always follow these practices to prevent CI failures and PR delays:**

1. **Pre-commit Code Quality Checks:**
- Run `black --line-length 79 src tests` before every commit
- Run `isort src tests` to fix import ordering
- Run `flake8 src tests` and fix ALL violations before committing
- Run `mypy src` and address type issues
- Use the one-liner: `black --line-length 79 src tests && isort src tests && flake8 src tests && mypy src`

2. **Import Management:**
- Remove unused imports immediately when refactoring
- Use isort to maintain consistent import ordering
- Avoid importing modules that aren't used

3. **Line Length & Formatting:**
- Maintain 79-character line limit (matches CI configuration)
- Let black handle most formatting automatically
- Break long lines in function arguments, not comments
- Use meaningful variable names even if they're longer

4. **Code Writing Best Practices:**
- Write code that passes linting from the start
- Fix linting issues as you code, not after
- Use type hints consistently
- Remove debug prints and unused variables immediately

### Automation Recommendations
To reduce PR iteration cycles, consider setting up:

1. **Pre-commit hooks** (add to `.pre-commit-config.yaml`):
```yaml
repos:
- repo: https://github.com/psf/black
rev: 25.1.0
hooks:
- id: black
args: [--line-length=79]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 7.3.0
hooks:
- id: flake8
```

2. **IDE/Editor Integration:**
- Configure VS Code/PyCharm to run black on save
- Enable flake8 linting in your editor
- Set up mypy type checking in your IDE

3. **Git Aliases** (add to ~/.gitconfig):
```bash
[alias]
lint = !black --line-length 79 src tests && isort src tests && flake8 src tests && mypy src
commit-clean = !git add . && git lint && git commit
```

### Code Organization
- Separate training environment (Forge) from deployment environment (MTGA)
- Modular design allowing different RL algorithms to be swapped
Expand Down
Loading