Development Setup¶
How to set up a full development environment with linting, CI, and verification.
Prerequisites¶
Same as user setup — see Installation. Additional tools for development:
| Tool | Purpose |
|---|---|
| ruff | Python linting and formatting |
| ESLint | JavaScript linting (via npx, no global install needed) |
| uv | Python package and venv management |
Full Dev Environment¶
# 1. Clone and run setup
git clone https://gitlab.com/bdpd/bdpd.git
cd bdpd
./scripts/setup.sh
source venv_py_bdpd/bin/activate
# 2. Install dev tools
uv pip install --python venv_py_bdpd/bin/python ruff
# 3. Verify
./scripts/check_env.sh
python shared/bdpd_check_env.py
Linting¶
Python (ruff)¶
# Check all Python source directories
ruff check shared/ agents/ experiments/ tools/
# Auto-fix
ruff check --fix shared/ agents/ experiments/ tools/
Configuration in pyproject.toml (rules: E, F, I, W, UP; ignores E501).
JavaScript (ESLint)¶
Configuration is embedded in .gitlab-ci.yml (default rules, sourceType: module).
Running Locally¶
Platform¶
LLM Middleman (standalone)¶
Card Game (heuristic demo)¶
python agents/cards_ai_play.py \
--deck1 warrior --deck2 temple \
--cards cards/cards_v03.json --demo --games 1
CI Pipeline¶
Defined in .gitlab-ci.yml (runs on every push):
| Stage | Job | Command |
|---|---|---|
lint |
lint:python |
ruff check shared/ agents/ experiments/ |
lint |
lint:node |
npx eslint platform/*.js |
deploy |
pages |
mkdocs build --strict --site-dir public (main branch only) |
The deploy job installs mkdocs-material and builds the documentation
site to GitLab Pages. It only runs on the main branch.
Running CI Locally¶
# Python lint
ruff check shared/ agents/ experiments/
# Node.js lint
npx eslint platform/*.js
# Docs build
mkdocs build --strict
Testing¶
Currently no automated test suite exists. Smoke tests:
# Platform responds
curl -s http://localhost:3000/api/health && echo "OK"
# Card game simulates
python agents/cards_ai_play.py \
--deck1 warrior --deck2 temple \
--cards cards/cards_v03.json --demo --games 1
# Card generator runs
python tools/card_generator/generate_cards.py \
--cards-json cards/cards_v03.json --dpi 72
Adding New Code¶
New Built-in Agent Strategy¶
- Add a class in
agents/built-in.jsextendingBaseAgent - Register it in
STRATEGY_REGISTRY - Add documentation in
docs/platform/agents.md
New Experiment Sweep¶
- Create a JSON definition in
experiments/definitions/ - Add the sweep name to
experiments/experiment.js(if using the Node.js runner) or run withpython experiments/sweep.py --definition
New Card Archetype¶
- Add 20 card entries to
cards/cards_v03.json - Add faction colours to
tools/card_generator/templates/faction_config.json - Run
generate_cards.pyto produce print-ready images
New Perturbation Type¶
- Add to
PERTURBATION_TYPESconstant inplatform/perturbation.js - Add a
caseinapplyPerturbation() - Document in
docs/platform/perturbations.md