Initial commit: VaultMesh Skills collection
Collection of operational skills for VaultMesh infrastructure including: - backup-sovereign: Backup and recovery operations - btc-anchor: Bitcoin anchoring - cloudflare-tunnel-manager: Cloudflare tunnel management - container-registry: Container registry operations - disaster-recovery: Disaster recovery procedures - dns-sovereign: DNS management - eth-anchor: Ethereum anchoring - gitea-bootstrap: Gitea setup and configuration - hetzner-bootstrap: Hetzner server provisioning - merkle-forest: Merkle tree operations - node-hardening: Node security hardening - operator-bootstrap: Operator initialization - proof-verifier: Cryptographic proof verification - rfc3161-anchor: RFC3161 timestamping - secrets-vault: Secrets management 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
102
operator-bootstrap/scripts/40_editor_setup.sh
Executable file
102
operator-bootstrap/scripts/40_editor_setup.sh
Executable file
@@ -0,0 +1,102 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# === METADATA ===
|
||||
SCRIPT_NAME="$(basename "$0")"
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
SKILL_ROOT="$(dirname "$SCRIPT_DIR")"
|
||||
|
||||
# === CONFIGURATION ===
|
||||
: "${NODE_NAME:=node-a}"
|
||||
: "${GITOPS_ROOT:=$HOME/infrastructure}"
|
||||
: "${ENABLE_KATE:=true}"
|
||||
: "${OUTPUT_DIR:=$SKILL_ROOT/outputs}"
|
||||
|
||||
# === FUNCTIONS ===
|
||||
log_info() { echo "[INFO] $(date -Iseconds) $*"; }
|
||||
log_warn() { echo "[WARN] $(date -Iseconds) $*" >&2; }
|
||||
|
||||
preflight() {
|
||||
GITOPS_ROOT="${GITOPS_ROOT/#\~/$HOME}"
|
||||
[[ -d "$OUTPUT_DIR" ]] || mkdir -p "$OUTPUT_DIR"
|
||||
}
|
||||
|
||||
setup_kate() {
|
||||
if [[ "$ENABLE_KATE" != "true" ]]; then
|
||||
log_info "Kate setup disabled (ENABLE_KATE=$ENABLE_KATE)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if ! command -v kate &>/dev/null; then
|
||||
log_warn "Kate not found - skipping editor setup"
|
||||
return 0
|
||||
fi
|
||||
|
||||
log_info "Setting up Kate project..."
|
||||
|
||||
local project_dir="$GITOPS_ROOT"
|
||||
local project_file="$project_dir/.kateproject"
|
||||
|
||||
[[ -d "$project_dir" ]] || mkdir -p "$project_dir"
|
||||
|
||||
if [[ -f "$project_file" ]]; then
|
||||
log_info "Kate project already exists at $project_file - skipping"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cat > "$project_file" <<EOF
|
||||
{
|
||||
"name": "$NODE_NAME Infrastructure",
|
||||
"files": [
|
||||
{
|
||||
"directory": ".",
|
||||
"filters": ["*.yml", "*.yaml", "*.toml", "*.json", "*.sh", "*.md"],
|
||||
"recursive": true
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
|
||||
log_info "Kate project file created: $project_file"
|
||||
}
|
||||
|
||||
setup_vim() {
|
||||
# Create basic .vimrc additions for infrastructure work if vim exists
|
||||
if ! command -v vim &>/dev/null && ! command -v nvim &>/dev/null; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
local vimrc="$HOME/.vimrc"
|
||||
local marker="\" Added by operator-bootstrap"
|
||||
|
||||
if [[ -f "$vimrc" ]] && grep -q "$marker" "$vimrc" 2>/dev/null; then
|
||||
log_info "Vim config already updated - skipping"
|
||||
return 0
|
||||
fi
|
||||
|
||||
cat >> "$vimrc" <<EOF
|
||||
|
||||
$marker
|
||||
" YAML settings for infrastructure files
|
||||
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab
|
||||
autocmd FileType json setlocal ts=2 sts=2 sw=2 expandtab
|
||||
|
||||
" Highlight trailing whitespace
|
||||
highlight ExtraWhitespace ctermbg=red guibg=red
|
||||
match ExtraWhitespace /\s\+$/
|
||||
EOF
|
||||
|
||||
log_info "Vim config updated with YAML/JSON settings"
|
||||
}
|
||||
|
||||
main() {
|
||||
preflight
|
||||
log_info "Starting $SCRIPT_NAME..."
|
||||
|
||||
setup_kate
|
||||
setup_vim
|
||||
|
||||
log_info "Completed $SCRIPT_NAME"
|
||||
}
|
||||
|
||||
[[ "${BASH_SOURCE[0]}" == "$0" ]] && main "$@"
|
||||
Reference in New Issue
Block a user