This commit is contained in:
2026-03-15 04:54:51 +01:00
parent 0fb8fe5a66
commit 7ac487f640
81 changed files with 3867 additions and 0 deletions

42
core/registry.sh Normal file
View File

@@ -0,0 +1,42 @@
#!/usr/bin/env bash
REGISTRY_MODULE_COUNT=0
declare -a REGISTRY_MODULES=()
declare -A REGISTRY_MODULE_PATHS=()
registry_init() {
local module_file=""
local module_id=""
REGISTRY_MODULE_COUNT=0
REGISTRY_MODULES=()
REGISTRY_MODULE_PATHS=()
while IFS= read -r module_file; do
# shellcheck source=/dev/null
source "$module_file"
module_id="${module_file#"$RUNTIME_PROJECT_ROOT/modules/"}"
module_id="${module_id%/module.sh}"
REGISTRY_MODULES+=("$module_id")
REGISTRY_MODULE_PATHS["$module_id"]="$module_file"
done < <(find "$RUNTIME_PROJECT_ROOT/modules" -mindepth 3 -maxdepth 3 -type f -name 'module.sh' | sort)
REGISTRY_MODULE_COUNT="${#REGISTRY_MODULES[@]}"
}
registry_summary() {
printf '%s' "$REGISTRY_MODULE_COUNT"
}
registry_list() {
printf '%s\n' "${REGISTRY_MODULES[@]}"
}
registry_has_module() {
local module_id="$1"
[[ -n "${REGISTRY_MODULE_PATHS[$module_id]:-}" ]]
}
registry_module_path() {
local module_id="$1"
printf '%s\n' "${REGISTRY_MODULE_PATHS[$module_id]:-}"
}