Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ help: ## - print the help and usage
sed 's/^[^:]*://' | \
awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

include mk/dev.mk
include mk/mkdocs.mk
include mk/adr.mk
63 changes: 63 additions & 0 deletions mk/dev.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Development workflow targets
# install, uninstall, test, lint — all driven through uv against the local .venv.

# Pin uv to the project-local virtualenv. This overrides any global
# UV_PROJECT_ENVIRONMENT a developer may have set, guaranteeing every
# `uv sync` / `uv run` here targets ./.venv.
export UV_PROJECT_ENVIRONMENT := $(CURDIR)/.venv

.PHONY: install uninstall test lint clean distclean run

install: ## - install project + dev dependencies into local .venv (creates/updates .venv as needed)
@echo "Syncing dev environment into $(UV_PROJECT_ENVIRONMENT)..."
@uv sync --group dev

uninstall: ## - remove the lola-ai package from the local .venv (dev deps remain)
@if [ ! -x "$(UV_PROJECT_ENVIRONMENT)/bin/python" ]; then \
echo "No venv at $(UV_PROJECT_ENVIRONMENT) — nothing to uninstall."; \
else \
echo "Uninstalling lola-ai from $(UV_PROJECT_ENVIRONMENT)..."; \
uv pip uninstall lola-ai; \
fi

test: ## - run the pytest suite
@echo "Running tests..."
@uv run pytest

run: ## - run the installed lola CLI; pass args via ARGS="..." (e.g., make run ARGS="mod ls")
@uv run lola $(ARGS)

lint: ## - run ruff (check + format check) and mypy on src
@echo "Running ruff check..."
@uv run ruff check src tests
@echo "Running ruff format check..."
@uv run ruff format --check src tests
@echo "Running mypy..."
@uv run mypy src

# Subtrees clean must never descend into: virtualenv, lola state, git internals.
# -prune (not -not -path) is required to skip the subtree entirely — otherwise
# find still descends and hits permission errors inside .lola/modules/.
CLEAN_PRUNE := \( -path './.venv' -o -path './.lola' -o -path './.git' \) -prune

clean: ## - remove build artifacts, caches, coverage, and Python bytecode (leaves .venv intact)
@echo "Cleaning build artifacts..."
@rm -rf build/ dist/
@find . $(CLEAN_PRUNE) -o -type d -name '*.egg-info' -exec rm -rf {} +
@echo "Cleaning lint, type-check, and test caches..."
@rm -rf .pytest_cache/ .ruff_cache/ .mypy_cache/
@echo "Cleaning coverage artifacts..."
@rm -rf .coverage htmlcov/
@echo "Cleaning test output..."
@rm -rf .test-output/
@echo "Cleaning Python bytecode..."
@find . $(CLEAN_PRUNE) -o -type d -name __pycache__ -exec rm -rf {} +
@find . $(CLEAN_PRUNE) -o -type f -name '*.pyc' -exec rm -f {} +
@echo "Done."

distclean: clean docs-clean ## - deep clean: also removes .venv and generated _version.py (slow to rebuild)
@echo "Removing virtual environment at $(UV_PROJECT_ENVIRONMENT)..."
@rm -rf $(UV_PROJECT_ENVIRONMENT)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Quote the venv path in destructive delete command.

Line 60 should quote $(UV_PROJECT_ENVIRONMENT) to avoid path-splitting edge cases.

Suggested patch
-	`@rm` -rf $(UV_PROJECT_ENVIRONMENT)
+	`@rm` -rf "$(UV_PROJECT_ENVIRONMENT)"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
@rm -rf $(UV_PROJECT_ENVIRONMENT)
`@rm` -rf "$(UV_PROJECT_ENVIRONMENT)"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@mk/dev.mk` at line 60, The rm -rf invocation in mk/dev.mk uses the
UV_PROJECT_ENVIRONMENT variable unquoted which can lead to path-splitting or
globbing issues; update the delete command to wrap the UV_PROJECT_ENVIRONMENT
variable in double quotes so the entire venv path is treated as a single
argument (modify the line containing `@rm` -rf $(UV_PROJECT_ENVIRONMENT) to quote
the variable).

@echo "Removing hatch-vcs generated _version.py..."
@rm -f src/lola/_version.py
@echo "Done. Run 'make install' to rebuild the environment."
Loading