This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
A suite of Bash CLI scripts (hf.*.sh) for managing HyperFleet clusters, node pools, databases, Kubernetes resources, and Maestro resources. There is no build system, package manager, or test framework — these are standalone Bash scripts that users add to their PATH.
# Syntax-check all scripts (no test suite exists)
for f in hf.*.sh; do bash -n "$f"; done
# Verify config system works end-to-end
./hf.config.sh show
./hf.config.sh doctorEvery script begins with source "$(dirname "$(realpath "$0")")/hf.lib.sh". This file provides:
- Config Property Registry (
HF_CONFIG_REGISTRY): Pipe-delimited array (section|key|default|flags) that is the single source of truth for all configuration properties. Every other script derives from this. - File-based config loading (
_hf_load): Each property maps to a file in~/.config/hf/<key>. Environment variables (HF_API_URL,HF_TOKEN, etc.) take precedence over files. - Config requirement declarations (
hf_require_config): Scripts declare their required config keys at the top. Used both for runtime validation and by thedoctorcommand to scan readiness. - API helpers:
hf_api,hf_get,hf_post,hf_delete— wrappers aroundcurl --http1.1targeting${HF_API_URL}/api/hyperfleet/${HF_API_VERSION}. - Kubernetes helpers:
hf_kubectl(context-aware),hf_kubectl_ns(context+namespace-aware). - ID management:
hf_cluster_id/hf_set_cluster_id,hf_nodepool_id/hf_set_nodepool_id— get from arg, file, or die. - Registry parsing:
_hf_parse "$entry"sets$_HF_E_SECTION,$_HF_E_KEY,$_HF_E_DEFAULT,$_HF_E_FLAGSwithout subshells (performance-critical — avoids fork/exec).
Subcommands: show, set, clear, doctor, bootstrap, env list|show|activate. Called with no args, it shows help + environments + active config. The doctor subcommand scans all scripts for hf_require_config lines using sed and cross-references with current config values.
hf.<resource>.<action>.sh — e.g., hf.cluster.create.sh, hf.nodepool.list.sh, hf.db.query.sh.
Named environments stored as <env-name>.<property> files in ~/.config/hf/. Activated via hf.config.sh env activate <name>, which copies env-specific files over the base config files.
- First line:
source "$(dirname "$(realpath "$0")")/hf.lib.sh" - Immediately declare dependencies:
hf_require_config api-url api-version cluster-id - Use
hf_require_jq,hf_require_kubectl, etc. for tool dependencies - Use
hf_cluster_id,hf_nodepool_idfor ID resolution (arg > file > die) - Pipe API JSON output through
| jq - Watch mode: parse
-wflag, useviddy -dfor live updates - Help text: use
hf_usage "<args>"then echo details - Colors: use
$BOLD,$GREEN,$RED,$YELLOW,$CYAN,$NC - Logging:
hf_info,hf_warn,hf_error,hf_die - Make scripts executable:
chmod +x
- Add one line to
HF_CONFIG_REGISTRYinhf.lib.sh - Add a
HF_*_FILEvariable and_hf_loadcall in the same file - Optionally add a setter function (
hf_set_*) - Scripts that need it add the key to their
hf_require_configcall
No other files need changes — hf.config.sh show, doctor, and environments all derive from the registry.
Registry parsing uses IFS='|' read into shell variables (_hf_parse) instead of subshells/cut/awk. This matters because hf.config.sh iterates the full registry multiple times. Avoid $(...) calls inside registry loops.
jq— JSON processing (most scripts)kubectl— Kubernetes operationsviddy— watch mode (-wflag on conditions/statuses scripts)psql— database scriptsgcloud— GCP operations (pubsub)maestro-cli— Maestro resource management (compiled from openshift-hyperfleet/maestro-cli)curl— API calls (used with--http1.1)