.PHONY: build build-release release test clippy check precommit install install-hooks clean init-python wheel publish publish-crate publish-pypi
build:
cargo build
build-release:
cargo build --release
@mkdir -p .bin
@ln -sf ../target/release/agent-doc .bin/agent-doc
@echo "Installed .bin/agent-doc -> target/release/agent-doc"
release: check
@version=$$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'); \
echo "Releasing v$$version..."; \
git tag "v$$version" && git push origin main "v$$version" && \
echo "Tag v$$version pushed. CI handles GitHub Release + PyPI."; \
cargo install --path .
test:
cargo test
clippy:
cargo clippy -- -D warnings
version-sync:
@cargo_ver=$$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'); \
pypi_ver=$$(grep '^version' pyproject.toml | head -1 | sed 's/.*"\(.*\)"/\1/'); \
if [ "$$cargo_ver" != "$$pypi_ver" ]; then \
echo "ERROR: version mismatch — Cargo.toml=$$cargo_ver pyproject.toml=$$pypi_ver"; \
exit 1; \
fi
plugin-version-check:
@if git diff --cached --name-only 2>/dev/null | grep -q '\.kt$$'; then \
if ! git diff --cached --name-only 2>/dev/null | grep -q 'gradle.properties'; then \
echo "ERROR: .kt files changed but editors/jetbrains/gradle.properties pluginVersion not bumped"; \
exit 1; \
fi; \
fi
check: clippy test version-sync
precommit: check plugin-version-check
cargo run --quiet -- audit-docs
install:
cargo install --path .
install-hooks:
@mkdir -p .git/hooks
@printf '#!/bin/sh\nmake precommit\n' > .git/hooks/pre-commit
@chmod +x .git/hooks/pre-commit
@echo "Installed .git/hooks/pre-commit"
clean:
cargo clean
rm -f .bin/agent-doc
init-python: PY_VERSION = $(shell [ -f .python-version ] && \
cat .python-version || echo "3.14")
init-python:
@echo "Setting up Python $(PY_VERSION) venv..."
@if command -v mise >/dev/null 2>&1; then \
mise install; \
fi
uv venv .venv --python "$(PY_VERSION)" --no-project --clear --seed $(VENV_ARGS)
uv pip install maturin
@echo "Venv ready. Use 'make wheel' to build, or '.venv/bin/maturin develop --release' to install into venv."
wheel:
.venv/bin/maturin develop --release
publish-crate:
cargo publish
publish-pypi:
.venv/bin/maturin publish --skip-existing
publish: publish-crate publish-pypi