Add decisions_sync.py that parses decisions/*.md markdown headings, extracts metadata (type, domain, status, round, date), and upserts into SQLite. Two-pass approach: decisions first, then cross-references to avoid FK violations on forward references. Schema adds decisions table (52 rows) and decision_refs table (29 rows) with cascading deletes. Makefile gains decisions-sync, decisions-coverage, decisions-active, and decisions-orphan targets. Sync runs as part of make setup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
117 lines
3.5 KiB
Makefile
117 lines
3.5 KiB
Makefile
.PHONY: help setup build client server test lint ci ci-client ci-server clean \
|
|
decisions-sync decisions-coverage decisions-active decisions-orphan
|
|
|
|
# Default
|
|
help:
|
|
@echo "The Settled Reach — Development Commands"
|
|
@echo ""
|
|
@echo " make setup Install dev dependencies (Rust, Godot, tooling)"
|
|
@echo " make build Build client and server"
|
|
@echo " make client Run the Godot client"
|
|
@echo " make server Run the Rust simulation server"
|
|
@echo " make test Run all tests"
|
|
@echo " make lint Run all linters"
|
|
@echo " make ci Run full CI pipeline locally"
|
|
@echo " make ci-client Run client CI checks"
|
|
@echo " make ci-server Run server CI checks"
|
|
@echo " make clean Remove build artifacts and caches"
|
|
@echo ""
|
|
@echo " make decisions-sync Sync decisions/*.md into SQLite"
|
|
@echo " make decisions-coverage Decision-to-ticket coverage by domain"
|
|
@echo " make decisions-active List active decisions"
|
|
@echo " make decisions-orphan Decisions without implementing tickets"
|
|
|
|
# --- Setup ---
|
|
|
|
setup: setup-rust setup-godot setup-tooling decisions-sync
|
|
@echo "Dev environment ready."
|
|
|
|
setup-rust:
|
|
@echo "Checking Rust toolchain..."
|
|
@command -v cargo >/dev/null 2>&1 || { echo "Install Rust: https://rustup.rs"; exit 1; }
|
|
@rustup component add clippy rustfmt
|
|
|
|
setup-godot:
|
|
@echo "Checking Godot..."
|
|
@command -v godot4 >/dev/null 2>&1 || command -v godot >/dev/null 2>&1 || { echo "Install Godot 4: https://godotengine.org"; exit 1; }
|
|
|
|
setup-tooling:
|
|
@echo "Checking tooling dependencies..."
|
|
@command -v python3 >/dev/null 2>&1 || { echo "Install Python 3"; exit 1; }
|
|
|
|
# --- Build ---
|
|
|
|
build: build-server build-client
|
|
|
|
build-server:
|
|
cd server && cargo build
|
|
|
|
build-client:
|
|
@echo "Client build: Godot exports are configured via the editor."
|
|
@echo "Use 'make client' to run the client directly."
|
|
|
|
# --- Run ---
|
|
|
|
server:
|
|
cd server && cargo run
|
|
|
|
client:
|
|
@if command -v godot4 >/dev/null 2>&1; then \
|
|
godot4 --path client; \
|
|
elif command -v godot >/dev/null 2>&1; then \
|
|
godot --path client; \
|
|
else \
|
|
echo "Godot not found. Run 'make setup' first."; exit 1; \
|
|
fi
|
|
|
|
# --- Test ---
|
|
|
|
test: test-server test-client
|
|
|
|
test-server:
|
|
cd server && cargo test
|
|
|
|
test-client:
|
|
@echo "Client tests run via gdUnit4 inside Godot."
|
|
@echo "TODO: headless test runner integration"
|
|
|
|
# --- Lint ---
|
|
|
|
lint: lint-server lint-client
|
|
|
|
lint-server:
|
|
cd server && cargo clippy -- -D warnings
|
|
cd server && cargo fmt --check
|
|
|
|
lint-client:
|
|
@echo "Client lint: TODO — gdlint / gdformat integration"
|
|
|
|
# --- CI (run locally) ---
|
|
|
|
ci: ci-server ci-client
|
|
|
|
ci-server: lint-server build-server test-server
|
|
|
|
ci-client: lint-client build-client test-client
|
|
|
|
# --- Decisions ---
|
|
|
|
decisions-sync:
|
|
@db/connectors/decisions-sync
|
|
|
|
decisions-coverage:
|
|
@db/connectors/sqlite-query "SELECT d.domain, COUNT(DISTINCT d.id) as decisions, COUNT(DISTINCT t.decision_ref) as with_tickets FROM decisions d LEFT JOIN tickets t ON d.id = t.decision_ref WHERE d.status='active' AND d.type='confirmed' GROUP BY d.domain"
|
|
|
|
decisions-active:
|
|
@db/connectors/sqlite-query "SELECT id, domain, title FROM decisions WHERE status='active' AND type='confirmed' ORDER BY domain, id"
|
|
|
|
decisions-orphan:
|
|
@db/connectors/sqlite-query "SELECT id, title FROM decisions WHERE type='confirmed' AND status='active' AND id NOT IN (SELECT DISTINCT decision_ref FROM tickets WHERE decision_ref IS NOT NULL)"
|
|
|
|
# --- Clean ---
|
|
|
|
clean:
|
|
cd server && cargo clean || true
|
|
rm -rf .cache/*
|
|
@echo "Clean complete."
|