Merge pull request 'chore: bootstrap Claude setup' (#1) from chore/bootstrap into main

Reviewed-on: #1
This commit is contained in:
dasemu committed 2026-10-18 19:17:22 +00:00
commit 42ea640da8
12 files changed
+175 -7

No files matched your search

+1
View File
@@ -0,0 +1 @@
2
+15
View File
@@ -0,0 +1,15 @@
{
"hooks": {
"Stop": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "cd \"$CLAUDE_PROJECT_DIR\" && if [ -x .venv/bin/python ]; then PY=.venv/bin/python; else PY=python3; fi; \"$PY\" -m pytest -q"
}
]
}
]
}
}
+15
View File
@@ -0,0 +1,15 @@
# SkiPredictor - environment variables
# Copy to .env and fill in real values. Never commit the real .env file.
# Telegram bot token (required for the bot and the in-process scheduler).
# See also bot/.env.example for the bot-only subset of this file.
TELEGRAM_BOT_TOKEN=
# Secret key used to sign JWTs issued by the FastAPI backend (app/api/auth.py).
JWT_SECRET_KEY=
# Comma-separated Telegram user IDs that receive daily accuracy reports (optional).
ADMIN_TELEGRAM_IDS=
# Override the default SQLite database path (optional).
SKIPREDICTOR_DB_PATH=
+27
View File
@@ -0,0 +1,27 @@
name: CI
on:
pull_request:
branches: [development]
push:
branches: [development, main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
# No linter is configured for the Python codebase yet (no ruff/black/flake8 in
# requirements.txt or config files), so only the test step runs here.
- name: Run tests
run: python -m pytest -q
+59
View File
@@ -0,0 +1,59 @@
name: Version bump
on:
push:
branches: [development, main]
permissions:
contents: write
jobs:
bump:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version
run: |
set -euo pipefail
CURRENT=$(cat VERSION)
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
if [ "${{ github.ref_name }}" = "development" ]; then
PATCH=$((PATCH + 1))
elif [ "${{ github.ref_name }}" = "main" ]; then
# Merge commit from an approved development -> main PR: bump MINOR.
# Any other push to main is treated as a hotfix: bump PATCH.
PARENTS=$(git log -1 --pretty=%P | wc -w)
if [ "$PARENTS" -ge 2 ] && git log -1 --pretty=%s | grep -qi "development"; then
MINOR=$((MINOR + 1))
PATCH=0
else
PATCH=$((PATCH + 1))
fi
fi
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
echo "$NEW_VERSION" > VERSION
git add VERSION
git commit -m "chore(release): v$NEW_VERSION [skip ci]"
git tag "v$NEW_VERSION"
git push origin HEAD:${{ github.ref_name }}
git push origin "v$NEW_VERSION"
- name: Merge main back into development
if: github.ref_name == 'main'
run: |
git fetch origin development
git checkout development
git merge --no-edit origin/main
git push origin development
+50
View File
@@ -0,0 +1,50 @@
# CLAUDE.md
## Overview
SkiPredictor forecasts next-day status (open probability, km open, crowd level) for three
Northern Spain ski stations, combining a rules engine with ML models (scikit-learn,
LightGBM) and YOLO-based webcam crowd detection. Delivered via a FastAPI backend and a
Telegram bot. See `AGENTS.md` for the full product/architecture spec.
## Commands
- Setup: `./setup.sh` (creates `.venv`, installs `requirements.txt`, downloads historical
data, trains initial models).
- Run backend + bot + scheduler: `./start.sh --cron --collect-now --bot`.
- Run API only: `.venv/bin/python -m uvicorn app.main:app --host 0.0.0.0 --port 8000`.
- Test: `.venv/bin/python -m pytest` (or `python3 -m pytest` if no venv).
- Lint/format: none configured for the Python codebase (no ruff/black/flake8 in
`requirements.txt`). The `mobile/` subproject has its own `npm run lint` (ESLint).
- Retrain models: `.venv/bin/python scripts/retrain_model.py`.
## Architecture
`data_sources/` (weather + station scraping + webcams) -> `pipeline/` (dataset build +
feature engineering) -> `ml/` + `predictor/` (rules engine, ML models, hybrid combiner) ->
`app/` (FastAPI backend, scheduler) and `bot/` (Telegram bot). `storage/` wraps the
SQLite database. `mobile/` is an independent Capacitor/React app, not wired into the
Python pipeline. Full details: `docs/DEPLOYMENT.md`, `docs/OPERATIONS.md`,
`docs/API_SPEC.md`.
## Conventions
- Station/feature parameters live in `config/stations.yaml` and `config/features.yaml`;
never hardcode station thresholds in code.
- Rules always take priority over ML output when physical conditions are deterministic
(e.g. extreme wind closes a station regardless of the ML prediction).
- SQLite (`storage/sqlite_store.py`) is the single source of truth; no CSV/JSON fallback
paths for data the DB already owns.
## Workflow quirks
- Use git worktrees under `.tmp/` for parallel feature work (see `AGENTS.md`), not
directories outside the repo.
- Production is assumed to run on the server unless told otherwise, even when iterating
locally.
## Deployment
Runs on a VPS/LXC under systemd (no Docker), serving the FastAPI app with an internal
APScheduler for forecast cycles and weekly retraining. See `docs/DEPLOYMENT.md` for the
systemd unit and `docs/OPERATIONS.md` for day-to-day tasks.
## Gotchas
- `requirements.txt` pulls in `ultralytics`/`opencv-python-headless` (YOLO) and
`lightgbm`; installs are heavy (~2 GB) and the first run downloads the YOLO weights.
- Historical webcam downloads must resolve the real image URL (see `LESSONS.md`) or you
silently save HTML instead of JPEGs.
+5 -5
View File
@@ -35,14 +35,14 @@ cd skipredictor
./start.sh --cron --collect-now --bot
```
*See [DEPLOYMENT.md](DEPLOYMENT.md) for detailed server setup, ML training, and systemd integration.*
*See [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md) for detailed server setup, ML training, and systemd integration.*
## 📖 Documentation
- [API Specification](API_SPEC.md): REST API endpoints, schemas, and authentication.
- [Deployment Guide](DEPLOYMENT.md): Server installation, cron jobs, and ML workflows.
- [Operations Guide](OPERATIONS.md): Common administrative tasks and troubleshooting.
- [TODO / Roadmap](TODO.md): Current status and planned features.
- [API Specification](docs/API_SPEC.md): REST API endpoints, schemas, and authentication.
- [Deployment Guide](docs/DEPLOYMENT.md): Server installation, cron jobs, and ML workflows.
- [Operations Guide](docs/OPERATIONS.md): Common administrative tasks and troubleshooting.
- [TODO / Roadmap](docs/TODO.md): Current status and planned features.
## ⚖️ License
+1
View File
@@ -0,0 +1 @@
0.1.0
View File
File renamed without changes.
+2 -2
View File
@@ -84,7 +84,7 @@ WantedBy=multi-user.target
## Legacy Cron Jobs (Optional)
If you prefer not to use the internal scheduler, you can still use standard cron jobs for daily collection and retraining. See [OPERATIONS.md](OPERATIONS.md) for details.
If you prefer not to use the internal scheduler, you can still use standard cron jobs for daily collection and retraining. See [OPERATIONS.md](./OPERATIONS.md) for details.
## Monitoring
@@ -94,4 +94,4 @@ If you prefer not to use the internal scheduler, you can still use standard cron
## Project Structure
*See [README.md](README.md) for the full directory tree.*
*See [README.md](../README.md) for the full directory tree.*
File renamed without changes.
View File
File renamed without changes.