From c371b1dcbb2c0a91bfbefc1c600ac6872ea4f4cc Mon Sep 17 00:00:00 2001 From: thereisnotime <37583483+thereisnotime@users.noreply.github.com> Date: Fri, 20 Mar 2026 13:38:17 +0200 Subject: [PATCH] Add make run-watch for auto-restart on code changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Uses watchfiles (already a dependency via uvicorn) to watch src/ and restart the bot whenever files change — handy during development. --- Makefile | 6 +++++- README.md | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 36671362..e1da1041 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: install dev test lint format clean help run run-remote remote-attach remote-stop \ +.PHONY: install dev test lint format clean help run run-watch run-remote remote-attach remote-stop \ bump-patch bump-minor bump-major release version # Default target @@ -11,6 +11,7 @@ help: @echo " format - Format code" @echo " clean - Clean up generated files" @echo " run - Run the bot" + @echo " run-watch - Run the bot with auto-restart on code changes" @echo " version - Show current version" @echo " bump-patch - Bump patch version (1.2.0 -> 1.2.1), commit, and tag" @echo " bump-minor - Bump minor version (1.2.0 -> 1.3.0), commit, and tag" @@ -49,6 +50,9 @@ clean: run: poetry run claude-telegram-bot +run-watch: ## Run the bot with auto-restart on src/ changes (uses watchfiles) + poetry run watchfiles "python -m src.main" src/ + # For debugging run-debug: poetry run claude-telegram-bot --debug diff --git a/README.md b/README.md index 34ca52d3..693c0d38 100644 --- a/README.md +++ b/README.md @@ -335,6 +335,7 @@ make test # Run tests with coverage make lint # Black + isort + flake8 + mypy make format # Auto-format code make run-debug # Run with debug logging +make run-watch # Run with auto-restart on code changes ``` > **Full documentation:** See the [docs index](docs/README.md) for all guides and references.