.DEFAULT_GOAL := help
CLOSES ?=
.PHONY: help check test lint fmt build release patch deploy restart smoke all
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
@echo ""
@echo " Workflow: ticket -> implement/test -> commit -> patch -> deploy -> smoke"
check:
cargo check --workspace
test:
cargo test --workspace
lint:
cargo clippy --workspace --all-targets -- -D warnings
fmt:
cargo fmt --all
build:
cargo build
release:
cargo build --release
patch:
cargo set-version --bump patch
@NEW_VERSION=$$(grep '^version' Cargo.toml | head -1 | sed 's/version = "\(.*\)"/\1/'); \
git add Cargo.toml Cargo.lock crates/trusty-memory-core/Cargo.toml crates/trusty-memory-mcp/Cargo.toml; \
COMMIT_MSG="chore: bump version to v$$NEW_VERSION"; \
if [ -n "$(CLOSES)" ]; then COMMIT_MSG="$$COMMIT_MSG (closes git commit -m "$$COMMIT_MSG"; \
git tag "v$$NEW_VERSION"; \
echo "Tagged v$$NEW_VERSION — push with: git push origin main --tags"
deploy:
cargo install --path . --locked
$(MAKE) restart
restart:
@echo "Restarting trusty-memory daemon via launchd..."
@launchctl bootout gui/$$(id -u)/com.bobmatnyc.trusty-memory 2>/dev/null || true
@launchctl bootout gui/$$(id -u)/com.trusty.trusty-memory 2>/dev/null || true
@sleep 2
@if [ -f "$(HOME)/Library/LaunchAgents/com.bobmatnyc.trusty-memory.plist" ]; then \
launchctl bootstrap gui/$$(id -u) $(HOME)/Library/LaunchAgents/com.bobmatnyc.trusty-memory.plist; \
elif [ -f "$(HOME)/Library/LaunchAgents/com.trusty.trusty-memory.plist" ]; then \
launchctl bootstrap gui/$$(id -u) $(HOME)/Library/LaunchAgents/com.trusty.trusty-memory.plist; \
else \
echo "ERROR: No launchd plist found. Install with: trusty-memory service install" >&2; \
exit 1; \
fi
@sleep 3
@trusty-memory status
@echo "trusty-memory daemon restarted"
smoke:
bash tests/smoke-test.sh
all: lint test build