.PHONY: all check test build release clean hooks version bump fmt clippy doc deny help docs-validate
CARGO := cargo
BINARY := target/release/zedazo
all: check test build
check:
$(CARGO) check --all-features
test:
$(CARGO) test --all-features
build:
$(CARGO) build
release:
$(CARGO) build --release --locked
clean:
$(CARGO) clean
deny:
@command -v cargo-deny >/dev/null || (echo "Instala: cargo install cargo-deny" && exit 1)
cargo deny check
docs-validate:
@echo "→ Validando frontmatter en docs canónicos..."
@for f in SPECS.md ROADMAP.md DECISIONS.md ARCHITECTURE.md AGENTS.md; do \
if ! head -20 "$$f" | grep -q "^version:"; then \
echo "❌ $$f: falta frontmatter"; exit 1; \
fi; \
echo "✓ $$f"; \
done
@echo "→ Validando stubs en docs/..."
@for f in docs/spec.md docs/architecture.md docs/roadmap.md docs/tasks.md; do \
if ! grep -q "redirige aquí\|canónico" "$$f"; then \
echo "❌ $$f: no redirige a doc canónico"; exit 1; \
fi; \
echo "✓ $$f"; \
done
@echo "→ Validando enlaces internos..."
@grep -r '\[.*\](\.?/.*\.md)' --include='*.md' . | grep -v '^Binary' | while read line; do \
file=$$(echo "$$line" | cut -d: -f1); \
link=$$(echo "$$line" | grep -o '](.*)' | sed 's/]//;s/(//;s/)//'); \
if [[ "$$link" == http* ]]; then continue; fi; \
target=$$(dirname "$$file")/$$link; \
if [[ ! -f "$$target" ]]; then \
echo "❌ Enlace roto en $$file: $$link"; exit 1; \
fi; \
done
@echo "✓ Enlaces internos OK"
@echo "→ Validando trazabilidad SPECS↔ROADMAP↔DECISIONS..."
@if ! grep -q "SPECS.md" ROADMAP.md || ! grep -q "DECISIONS.md" ROADMAP.md; then \
echo "❌ ROADMAP.md no referencia SPECS/DECISIONS"; exit 1; \
fi
@if ! grep -q "ROADMAP.md" SPECS.md || ! grep -q "DECISIONS.md" SPECS.md; then \
echo "❌ SPECS.md no referencia ROADMAP/DECISIONS"; exit 1; \
fi
@if ! grep -q "SPECS.md" DECISIONS.md || ! grep -q "ROADMAP.md" DECISIONS.md; then \
echo "❌ DECISIONS.md no referencia SPECS/ROADMAP"; exit 1; \
fi
@if ! grep -q "ROADMAP.md" ARCHITECTURE.md || ! grep -q "DECISIONS.md" ARCHITECTURE.md; then \
echo "❌ ARCHITECTURE.md no referencia ROADMAP/DECISIONS"; exit 1; \
fi
@echo "✓ Trazabilidad OK"
@echo "✓ docs-validate completado"
traceability:
@sh scripts/traceability.sh
fmt:
$(CARGO) fmt
fmt-check:
$(CARGO) fmt --all -- --check
clippy:
$(CARGO) clippy --all-features -- -D warnings
lint: fmt clippy
hooks:
@sh .githooks/install.sh
version:
@grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/'
bump-patch:
@sh scripts/bump.sh patch
bump-minor:
@sh scripts/bump.sh minor
bump-major:
@sh scripts/bump.sh major
ci: fmt-check clippy test check doc docs-validate
doc:
$(CARGO) doc --no-deps --document-private-items
@echo "Documentación generada en target/doc/"
completions:
$(CARGO) build --release
mkdir -p completions
$(BINARY) completions bash > completions/zedazo.bash
$(BINARY) completions zsh > completions/_zedazo
$(BINARY) completions fish > completions/zedazo.fish
@echo "Completions generados en completions/"
@echo " bash: source completions/zedazo.bash"
@echo " zsh: fpath+=(completions/_zedazo)"
@echo " fish: cp completions/zedazo.fish ~/.config/fish/completions/"
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'