feat: Introduce cross_source flag for genome registry entries
This commit is contained in:
parent
22239f4bb5
commit
bad41d6313
3 changed files with 25 additions and 12 deletions
12
registry.sh
12
registry.sh
|
|
@ -19,13 +19,15 @@ LIB_DIR="${PROJECT_ROOT}/lib"
|
||||||
PROVIDERS_DIR="${PROJECT_ROOT}/providers"
|
PROVIDERS_DIR="${PROJECT_ROOT}/providers"
|
||||||
|
|
||||||
# --- GENOME REGISTRY ---
|
# --- GENOME REGISTRY ---
|
||||||
# Format: "name|description|linked_repo"
|
# Format: "name|description|linked_repo|cross_source"
|
||||||
# - linked_repo is OPTIONAL. Leave empty (trailing pipe) for knowledge-only genomes.
|
# - linked_repo: OPTIONAL. Leave empty for knowledge-only genomes.
|
||||||
|
# - cross_source: "yes" or "no" (default: no). Controls whether the collector
|
||||||
|
# may read this genome as a source during cross-genome pulls.
|
||||||
#
|
#
|
||||||
# HOW TO CUSTOMIZE:
|
# HOW TO CUSTOMIZE:
|
||||||
# Replace the placeholder below with your actual genome domains.
|
# Replace the placeholder below with your actual genome domains.
|
||||||
# Example: "genome-work|Work notes and architecture logs|"
|
# Example: "genome-work|Work notes and architecture logs||no"
|
||||||
# "genome-finance|Personal finance|user/repo-finance"
|
# "genome-finance|Personal finance|user/repo-finance|no"
|
||||||
GENOMES=(
|
GENOMES=(
|
||||||
"genome-example|Template genome description for knowledge management|"
|
"genome-example|Template genome description for knowledge management||no"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,27 @@ source "registry.sh"
|
||||||
GENOME_NAME="${1:-}"
|
GENOME_NAME="${1:-}"
|
||||||
GENOME_DESC="${2:-}"
|
GENOME_DESC="${2:-}"
|
||||||
GENOME_LINKED="${3:-}" # optional: linked project repo reference
|
GENOME_LINKED="${3:-}" # optional: linked project repo reference
|
||||||
|
GENOME_CROSS_SOURCE="${4:-no}" # optional: cross_source flag (default: no)
|
||||||
|
|
||||||
|
# 1. Check mandatory arguments first
|
||||||
if [[ -z "$GENOME_NAME" || -z "$GENOME_DESC" ]]; then
|
if [[ -z "$GENOME_NAME" || -z "$GENOME_DESC" ]]; then
|
||||||
error "Missing arguments."
|
error "Missing arguments."
|
||||||
echo "Usage: $0 <genome-name> <description> [linked-repo]"
|
echo "Usage: $0 <genome-name> <description> [linked-repo] [cross_source]"
|
||||||
|
echo " cross_source: yes|no (default: no)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# 2. Then validate the flag if a non-default value was passed
|
||||||
|
if [[ "$GENOME_CROSS_SOURCE" != "yes" && "$GENOME_CROSS_SOURCE" != "no" ]]; then
|
||||||
|
error "Invalid cross_source value: $GENOME_CROSS_SOURCE"
|
||||||
|
echo "cross_source must be 'yes' or 'no'"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
step "Adding New Genome: ${GENOME_NAME}"
|
step "Adding New Genome: ${GENOME_NAME}"
|
||||||
|
|
||||||
# Build a 3-field registry entry (linked_repo may be empty)
|
# Build a 4-field registry entry (linked_repo may be empty, cross_source defaults to no)
|
||||||
GENOMES=("${GENOME_NAME}|${GENOME_DESC}|${GENOME_LINKED}")
|
GENOMES=("${GENOME_NAME}|${GENOME_DESC}|${GENOME_LINKED}|${GENOME_CROSS_SOURCE}")
|
||||||
|
|
||||||
# NOTE — Maintenance smell
|
# NOTE — Maintenance smell
|
||||||
# We source setup-genomes.sh as a library/orchestrator hybrid. This works because:
|
# We source setup-genomes.sh as a library/orchestrator hybrid. This works because:
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,11 @@ step "Processing Genome Registry"
|
||||||
|
|
||||||
for entry in "${GENOMES[@]}"; do
|
for entry in "${GENOMES[@]}"; do
|
||||||
# 3-field format: name|description|linked_repo (linked_repo optional → may be empty)
|
# 3-field format: name|description|linked_repo (linked_repo optional → may be empty)
|
||||||
IFS='|' read -r GENOME_NAME GENOME_DESC GENOME_LINKED <<< "$entry"
|
IFS='|' read -r GENOME_NAME GENOME_DESC GENOME_LINKED GENOME_CROSS_SOURCE <<< "$entry"
|
||||||
export GENOME_NAME GENOME_DESC GENOME_LINKED
|
GENOME_CROSS_SOURCE="${GENOME_CROSS_SOURCE:-no}"
|
||||||
|
export GENOME_NAME GENOME_DESC GENOME_LINKED GENOME_CROSS_SOURCE
|
||||||
|
|
||||||
info "Processing: ${GENOME_NAME}..."
|
info "Processing: ${GENOME_NAME} (cross_source: ${GENOME_CROSS_SOURCE})..."
|
||||||
|
|
||||||
# 1. Remote Creation (Idempotent)
|
# 1. Remote Creation (Idempotent)
|
||||||
provider_create_repo "${GENOME_NAME}" "${GENOME_DESC}" "true"
|
provider_create_repo "${GENOME_NAME}" "${GENOME_DESC}" "true"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue