Skip to content

Commit d04403a

Browse files
JacobCoffeeclaude
andcommitted
chore: add worktree management and pre-push CI checks
- Added make worktree and make worktree-prune commands - Added pre-push hook to run CI before pushing - Organized Makefile with section headers - Updated prek configuration 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
2 parents 9e5550b + 14fc81e commit d04403a

File tree

3 files changed

+48
-9
lines changed

3 files changed

+48
-9
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
default_language_version:
22
python: "3.13"
3-
default_install_hook_types: [commit-msg, pre-commit]
3+
default_install_hook_types: [commit-msg, pre-commit, pre-push]
44
repos:
55
- repo: https://github.com/compilerla/conventional-pre-commit
66
rev: v4.3.0
@@ -18,7 +18,7 @@ repos:
1818
- id: mixed-line-ending
1919
- id: trailing-whitespace
2020
- repo: https://github.com/astral-sh/ruff-pre-commit
21-
rev: "v0.14.6"
21+
rev: v0.14.6
2222
hooks:
2323
- id: ruff-check
2424
args: ["--fix"]
@@ -38,7 +38,7 @@ repos:
3838
hooks:
3939
- id: blacken-docs
4040
- repo: https://github.com/pre-commit/mirrors-prettier
41-
rev: "v4.0.0-alpha.8"
41+
rev: v4.0.0-alpha.8
4242
hooks:
4343
- id: prettier
4444
exclude: "_templates|.git"
@@ -90,7 +90,14 @@ repos:
9090
language: system
9191
types: [python]
9292
pass_filenames: false
93+
- id: pre-push-ci
94+
name: Run CI checks before push
95+
entry: make ci
96+
language: system
97+
stages: [pre-push]
98+
pass_filenames: false
99+
verbose: true
93100
- repo: https://github.com/sphinx-contrib/sphinx-lint
94-
rev: "v1.0.2"
101+
rev: v1.0.2
95102
hooks:
96103
- id: sphinx-lint

Makefile

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ UV ?= uv $(UV_OPTS)
1818
.PHONY: clean run-dev-frontend run-dev-server production develop destroy
1919
.PHONY: docker-up docker-down docker-logs docker-shell-api docker-shell-bot docker-ps
2020
.PHONY: docker-restart docker-rebuild infra-up infra-down
21+
.PHONY: worktree worktree-prune
2122

2223
help: ## Display this help text for Makefile
2324
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
2425

26+
##@ Setup & Installation
27+
2528
upgrade: ## Upgrade all dependencies to the latest stable versions
2629
@echo "=> Upgrading prek"
27-
@(UV_RUN_BIN) run prek autoupdate
30+
@$(UV) run prek autoupdate
2831
@if [ "$(USING_UV)" ]; then $(UV) lock --upgrade
2932
@echo "Dependencies Updated"
3033

@@ -39,10 +42,11 @@ install-uv: ## Install latest version of UV
3942

4043
install-prek: ## Install prek and install hooks
4144
@echo "Installing prek hooks"
42-
@(UV_RUN_BIN) run prek install
43-
@(UV_RUN_BIN) run prek install --hook-type commit-msg
45+
@$(UV) run prek install
46+
@$(UV) run prek install --hook-type commit-msg
47+
@$(UV) run prek install --hook-type pre-push
4448
@echo "=> prek hooks installed"
45-
@(UV_RUN_BIN) run prek autoupdate
49+
@$(UV) run prek autoupdate
4650
@echo "prek installed"
4751

4852
.PHONY: install-frontend
@@ -90,6 +94,8 @@ refresh-container: clean-container up-container load-container ## Refresh the By
9094
# Tests, Linting, Coverage
9195
# =============================================================================
9296

97+
##@ Code Quality
98+
9399
lint: ## Runs prek hooks; includes ruff linting, codespell, black
94100
@$(UV) run --no-sync prek run --all-files
95101

@@ -126,6 +132,9 @@ ci: check-all ## Run all checks for CI
126132
# =============================================================================
127133
# Docs
128134
# =============================================================================
135+
136+
##@ Documentation
137+
129138
docs-clean: ## Dump the existing built docs
130139
@echo "=> Cleaning documentation build assets"
131140
@rm -rf docs/_build
@@ -142,6 +151,9 @@ docs: docs-clean ## Dump the existing built docs and rebuild them
142151
# =============================================================================
143152
# Database
144153
# =============================================================================
154+
155+
##@ Database Operations
156+
145157
migrations: ## Generate database migrations
146158
@echo "ATTENTION: This operation will create a new database migration for any defined models changes."
147159
@while [ -z "$$MIGRATION_MESSAGE" ]; do read -r -p "Migration message: " MIGRATION_MESSAGE; done ;
@@ -160,6 +172,8 @@ db: ## Run the database
160172
# Docker Compose Commands
161173
# =============================================================================
162174

175+
##@ Docker Development
176+
163177
.PHONY: docker-up
164178
docker-up: ## Start all services (PostgreSQL, API, Bot) with Docker Compose
165179
@echo "=> Starting all services with Docker Compose"
@@ -242,6 +256,24 @@ infra-down: ## Stop PostgreSQL infrastructure
242256
@docker compose -f docker-compose.infra.yml down
243257
@echo "=> PostgreSQL stopped"
244258

259+
# =============================================================================
260+
# Git Worktree Management
261+
# =============================================================================
262+
263+
##@ Git Worktrees
264+
265+
worktree: ## Create a new git worktree for feature branch
266+
@echo "=> Creating git worktree"
267+
@read -p "Feature name: " name; \
268+
git checkout main && git pull && \
269+
git worktree add worktrees/$$name -b feature/$$name && \
270+
echo "=> Worktree created at worktrees/$$name on branch feature/$$name"
271+
272+
worktree-prune: ## Clean up stale git worktrees
273+
@echo "=> Pruning stale git worktrees"
274+
@git worktree prune -v
275+
@echo "=> Stale worktrees pruned"
276+
245277
# =============================================================================
246278
# Main
247279
# =============================================================================

services/api/src/byte_api/domain/guilds/services.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class ForumConfigRepository(SQLAlchemyAsyncRepository[ForumConfig]):
133133
class ForumConfigService(SQLAlchemyAsyncRepositoryService[ForumConfig]):
134134
"""Handles basic operations for the guilds' Forum config."""
135135

136-
repository_type = AllowedUsersConfigRepository
136+
repository_type = ForumConfigRepository
137137
match_fields = ["guild_id"]
138138

139139
async def to_model(self, data: ModelDictT[ForumConfig], operation: str | None = None) -> ForumConfig:

0 commit comments

Comments
 (0)