diff --git a/AGENTS.md b/AGENTS.md index e16bcfa..80590b1 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,49 +2,60 @@ ## Project Overview -This is a simple Flask web application - a "Jeopardy-style" quiz game about the Russian short story "Уроки французского" by Valentin Rasputin. The project uses: -- **Backend**: Python 3.13 with Flask -- **Frontend**: HTML, CSS, JavaScript (vanilla) -- **Data Storage**: JSON file (`data/questions.json`) -- **State**: Browser localStorage (client-side) +This is a Flask web application - a "Jeopardy-style" quiz game about the Russian short story "Уроки французского" by Valentin Rasputin. + +**Tech Stack:** +- Backend: Python 3.13 with Flask +- Frontend: HTML, CSS, JavaScript (vanilla) +- Data Storage: JSON file (`data/questions.json`) +- State: Browser localStorage (client-side) +- Container: Docker ## Build/Test Commands -### Running the Application +### Running Locally (without Docker) ```bash # Activate virtual environment source venv/bin/activate # Run Flask app (default port 5000) -python app.py +python src/app.py # Run on specific port -python -c "from app import app; app.run(port=5002)" +python -c "from src.app import app; app.run(port=5002)" ``` -### No Formal Tests +### Running with Docker + +```bash +# Build image +./build.sh + +# Run container +./run.sh + +# Stop container +docker stop sigra && docker rm sigra +``` + +**Note:** Dockerfile copies only `src/` directory into the container (app.py, data/, templates/, static/). + +### Manual Testing This project does not have a formal test suite. For manual testing: - Use `curl` to test API endpoints -- Test in browser at http://localhost:5000 (or configured port) - -### Linting/Type Checking - -No formal linter is configured. The codebase uses basic Python and JavaScript. +- Test in browser at http://localhost:5000 ## Code Style Guidelines ### Python (app.py) -**Imports** -- Standard library first, then third-party -- Use absolute imports -- Example: - ```python - import json - from flask import Flask, render_template, request, redirect, url_for, make_response - ``` +**Imports** - Standard library first, then third-party: +```python +import json +from flask import Flask, render_template, request, redirect, url_for, make_response +``` **Formatting** - Use 4 spaces for indentation @@ -71,20 +82,18 @@ No formal linter is configured. The codebase uses basic Python and JavaScript. **General** - Use vanilla JavaScript (no frameworks) - Prefer `var` over `let/const` for compatibility -- Use `function` keyword instead of arrow functions where possible +- Use `function` keyword instead of arrow functions **Event Handling** -- Use `onclick` directly in HTML or `element.onclick = function()` +- Use `onclick` directly in HTML or `element.onclick = function()` - Avoid `addEventListener` for simplicity **DOM Manipulation** - Use `document.getElementById` and `document.querySelector` -- Template literals for dynamic content: `` `string ${variable}` `` +- Template literals for dynamic content - Use `JSON.parse()` and `JSON.stringify()` for localStorage -**Naming** -- camelCase for variables and functions -- Descriptive names (e.g., `currentTeam`, `selectAnswer`) +**Naming** - camelCase for variables and functions ### HTML/CSS (templates/*.html) @@ -99,57 +108,65 @@ No formal linter is configured. The codebase uses basic Python and JavaScript. - Keep responsive design in mind **Structure** -- Inline CSS in `