|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `modules/` holds core Python runtime, UI, and model plumbing (most edits land here). |
| 5 | +- `scripts/` contains optional generation/postprocessing scripts; `extensions-builtin/` and `extensions/` are for bundled and user extensions. |
| 6 | +- Frontend assets live in `javascript/`, `html/`, `style.css`, and `script.js`. |
| 7 | +- Configuration and model assets are under `configs/`, `models/`, `embeddings/`, and `textual_inversion_templates/`. |
| 8 | +- Tests live in `test/` with fixtures and assets in `test/test_files/`. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- `webui-user.bat` (Windows) or `./webui.sh` (Linux/macOS) starts the app and manages deps. |
| 12 | +- `python launch.py` runs the launcher directly (useful for debugging). |
| 13 | +- `npm run lint` runs ESLint for JavaScript; `npm run fix` applies fixes. |
| 14 | +- `python -m ruff check .` runs Python linting if Ruff is installed. |
| 15 | + |
| 16 | +## Coding Style & Naming Conventions |
| 17 | +- Python follows PEP 8 conventions (4 spaces, `snake_case`), with Ruff configured in `pyproject.toml`. |
| 18 | +- JavaScript uses 4-space indentation and ESLint rules from `.eslintrc.js`; prefer `camelCase`. |
| 19 | +- Keep new files near their feature area (e.g., UI changes in `modules/ui_*.py`, assets in `javascript/`/`html/`). |
| 20 | + |
| 21 | +## Testing Guidelines |
| 22 | +- Tests use `pytest` (`requirements-test.txt`) with `test_*.py` naming. |
| 23 | +- API tests assume the web UI is running at `http://127.0.0.1:7860` (see `pyproject.toml`). |
| 24 | +- Run all tests with `pytest` from the repo root; add new tests alongside related modules. |
| 25 | + |
| 26 | +## Commit & Pull Request Guidelines |
| 27 | +- Recent history uses short, lower-case subjects and includes merge commits (e.g., `update CHANGELOG`). |
| 28 | +- Keep commit subjects concise and specific; avoid bundling unrelated changes. |
| 29 | +- PRs should describe the user-facing impact, include steps to test, and link relevant issues. |
| 30 | + |
| 31 | +## Configuration & Assets |
| 32 | +- Put local launch args in `webui-user.bat` or `webui-user.sh`; avoid committing machine-specific paths. |
| 33 | +- Large model files and generated images belong in `models/` and `outputs/`, and should not be committed. |
0 commit comments