feat(build): Introduce testing, structure management, and linked genome support

This commit is contained in:
Matteo Cherubini 2026-06-05 09:24:58 +02:00
parent 624bd5f8d5
commit 42c1302035
2 changed files with 27 additions and 13 deletions

View file

@ -1,19 +1,22 @@
# ============================================================================= # =============================================================================
# Knowledge Genome - Makefile v. 1.0.0 # Knowledge Genome - Makefile v. 1.1.0
# Orchestrates the setup and management of the knowledge base. # Orchestrates the setup and management of the knowledge base.
# ============================================================================= # =============================================================================
include globals.env include globals.env
export $(shell grep -v '^[#[:space:]]' globals.env | sed 's/=.*//') export $(shell grep -v '^[#[:space:]]' globals.env | sed 's/=.*//')
.PHONY: setup add-genome status lint lock doctor sync help .PHONY: setup add-genome status lint lock doctor sync test verify-structure sync-structure help
help: help:
@echo "Available commands:" @echo "Available commands:"
@echo " make setup - Full system initialization" @echo " make setup - Full system initialization"
@echo " make add-genome - Register and scaffold a new genome" @echo " make add-genome - Register and scaffold a new genome [LINKED=owner/repo]"
@echo " make status - Check submodule and encryption status" @echo " make status - Check submodule and encryption status"
@echo " make lint - Verify schema, privacy flags, and metadata" @echo " make lint - Verify schema, privacy flags, and metadata"
@echo " make verify-structure - Report directory drift across all genomes"
@echo " make sync-structure - Create any missing canonical dirs (safe)"
@echo " make test - Run the bats test suite (no LLM/GPU needed)"
@echo " make lock - Lock all encrypted files across all genomes" @echo " make lock - Lock all encrypted files across all genomes"
@echo " make doctor - Verify all required tools are installed" @echo " make doctor - Verify all required tools are installed"
@echo " make sync - Sync submodules and report unpushed commits" @echo " make sync - Sync submodules and report unpushed commits"
@ -27,16 +30,26 @@ setup:
add-genome: add-genome:
@if [ -z "$(NAME)" ] || [ -z "$(DESC)" ]; then \ @if [ -z "$(NAME)" ] || [ -z "$(DESC)" ]; then \
echo "Error: NAME and DESC are required."; \ echo "Error: NAME and DESC are required."; \
echo "Usage: make add-genome NAME=my-genome DESC='My description'"; \ echo "Usage: make add-genome NAME=my-genome DESC='My description' [LINKED=owner/project-repo]"; \
exit 1; \ exit 1; \
fi fi
@bash scripts/add-genome.sh "$(NAME)" "$(DESC)" @bash scripts/add-genome.sh "$(NAME)" "$(DESC)" "$(LINKED)"
status: status:
@echo "--- Master Status ---" @echo "--- Master Status ---"
@git submodule status @git submodule status
@echo "--- Encryption Status (First 10 files) ---" @echo "--- Encryption Status (per genome) ---"
@git-crypt status | head -n 10 @git submodule foreach 'git-crypt status 2>/dev/null | head -n 10 || true'
verify-structure:
@bash scripts/verify-genomes.sh
sync-structure:
@bash scripts/verify-genomes.sh --sync
test:
@command -v bats >/dev/null 2>&1 || { echo " MISSING: bats (sudo apt install bats)"; exit 1; }
@bats tests/
doctor: doctor:
@echo "Checking required tools..." @echo "Checking required tools..."
@ -45,6 +58,7 @@ doctor:
@command -v curl >/dev/null 2>&1 || { echo " MISSING: curl"; exit 1; } @command -v curl >/dev/null 2>&1 || { echo " MISSING: curl"; exit 1; }
@command -v jq >/dev/null 2>&1 || { echo " MISSING: jq"; exit 1; } @command -v jq >/dev/null 2>&1 || { echo " MISSING: jq"; exit 1; }
@command -v bw >/dev/null 2>&1 || echo " OPTIONAL: bw (Bitwarden CLI) not found — key injection will be manual." @command -v bw >/dev/null 2>&1 || echo " OPTIONAL: bw (Bitwarden CLI) not found — key injection will be manual."
@command -v python3 >/dev/null 2>&1 || echo " OPTIONAL: python3 not found — needed for 'make test' and the ingest skill (index-append.py), not for setup."
@echo "System ready." @echo "System ready."
sync: sync: