Domus Scripts

Overview

Scripts for managing the domus-* documentation ecosystem. Located in domus-linux-ops/scripts/.

domus-push-all

Push all domus-* repositories to all configured remotes (GitHub, GitLab, Gitea).

Location

~/atelier/_bibliotheca/domus-linux-ops/scripts/domus-push-all.sh
~/.local/bin/domus-push-all  # symlink

Prerequisites

Load SSH keys into agent:

ssh-add ~/.ssh/id_ed25519         # GitHub
ssh-add ~/.ssh/id_ed25519_gitlab  # GitLab
ssh-add ~/.ssh/id_ed25519_gitea   # Gitea

Usage

# Check status of all repos (uncommitted, ahead, behind)
domus-push-all --status

# Preview what would be pushed
domus-push-all --dry-run

# Push all repos to all remotes
domus-push-all

Example Output

--status
Domus Repository Status
========================

Repository                 Uncommitted      Ahead     Behind
----------                 -----------      -----     ------
domus-antora-ui                      0          0          0
domus-automation-ops                 0          0          0
domus-captures                       0          0          0
domus-docs                           0          0          0
domus-infra-ops                      0          0          0
domus-ise-linux                      0          0          0
domus-netapi-docs                    0          0          0
domus-python                         0          1          0
domus-secrets-ops                    0          0          0
Push output
Pushing Domus Repositories
===========================

=== domus-infra-ops ===
  origin: up-to-date
  gitea: up-to-date
  gitlab: up-to-date

=== domus-ise-linux ===
  origin: pushed
  gitea: pushed
  gitlab: pushed

===========================
Summary
  Repositories: 16
  Pushed:       3
  Up-to-date:   45

Options

Option Description

--status

Show status of all repos without pushing

--dry-run

Preview what would be pushed

--help

Show usage information

Environment Variables

Variable Default Description

DOMUS_BASE

~/atelier/_bibliotheca

Base directory containing domus-* repos

SSH_AUTH_SOCK

/run/user/$(id -u)/ssh-agent.socket

SSH agent socket path

Full Script Source

Click to expand domus-push-all.sh
#!/usr/bin/env bash
# ============================================================================
# domus-push-all.sh - Push all domus-* repos to all configured remotes
# ============================================================================
# Usage: domus-push-all.sh [--dry-run] [--status]
#
# Requires ssh-agent with keys loaded:
#   ssh-add ~/.ssh/id_ed25519_gitea
#   ssh-add ~/.ssh/id_ed25519_gitlab
#   ssh-add ~/.ssh/id_ed25519  # github
#
# Or set SSH_AUTH_SOCK to point to your agent socket.
# ============================================================================

set -euo pipefail

# Configuration
DOMUS_BASE="${DOMUS_BASE:-$HOME/atelier/_bibliotheca}"
SSH_AUTH_SOCK="${SSH_AUTH_SOCK:-/run/user/$(id -u)/ssh-agent.socket}"
export SSH_AUTH_SOCK

# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
BOLD='\033[1m'

# Counters
TOTAL=0
PUSHED=0
UPTODATE=0
FAILED=0

usage() {
    echo "Usage: $(basename "$0") [OPTIONS]"
    echo ""
    echo "Push all domus-* repos to all configured remotes."
    echo ""
    echo "Options:"
    echo "  --dry-run    Show what would be pushed without pushing"
    echo "  --status     Show status of all repos (uncommitted, ahead/behind)"
    echo "  --help       Show this help message"
    echo ""
    echo "Environment:"
    echo "  DOMUS_BASE       Base directory (default: ~/atelier/_bibliotheca)"
    echo "  SSH_AUTH_SOCK    SSH agent socket (default: /run/user/\$(id -u)/ssh-agent.socket)"
}

show_status() {
    echo -e "${BOLD}Domus Repository Status${NC}"
    echo "========================"
    echo ""
    printf "%-25s %12s %10s %10s\n" "Repository" "Uncommitted" "Ahead" "Behind"
    printf "%-25s %12s %10s %10s\n" "----------" "-----------" "-----" "------"

    for repo in "$DOMUS_BASE"/domus-*/; do
        [[ -d "$repo/.git" ]] || continue
        name=$(basename "$repo")

        uncommitted=$(git -C "$repo" status --porcelain 2>/dev/null | wc -l)
        ahead=$(git -C "$repo" rev-list --count @{u}..HEAD 2>/dev/null || echo "?")
        behind=$(git -C "$repo" rev-list --count HEAD..@{u} 2>/dev/null || echo "?")

        # Color code
        if [[ "$uncommitted" -gt 0 ]]; then
            uncommitted="${YELLOW}${uncommitted}${NC}"
        fi
        if [[ "$ahead" != "?" && "$ahead" -gt 0 ]]; then
            ahead="${GREEN}${ahead}${NC}"
        fi
        if [[ "$behind" != "?" && "$behind" -gt 0 ]]; then
            behind="${RED}${behind}${NC}"
        fi

        printf "%-25s %12b %10b %10b\n" "$name" "$uncommitted" "$ahead" "$behind"
    done
}

push_all() {
    local dry_run=$1

    echo -e "${BOLD}Pushing Domus Repositories${NC}"
    echo "==========================="
    echo ""

    for repo in "$DOMUS_BASE"/domus-*/; do
        [[ -d "$repo/.git" ]] || continue
        name=$(basename "$repo")
        ((TOTAL++))

        echo -e "${CYAN}=== $name ===${NC}"

        # Get all remotes
        remotes=$(git -C "$repo" remote 2>/dev/null)

        if [[ -z "$remotes" ]]; then
            echo -e "  ${YELLOW}No remotes configured${NC}"
            continue
        fi

        for remote in $remotes; do
            if [[ "$dry_run" == "true" ]]; then
                echo -e "  ${BLUE}[DRY-RUN]${NC} Would push to $remote"
            else
                echo -n "  $remote: "
                output=$(git -C "$repo" push "$remote" main 2>&1) && result=$? || result=$?

                if [[ $result -eq 0 ]]; then
                    if echo "$output" | grep -q "Everything up-to-date"; then
                        echo -e "${GREEN}up-to-date${NC}"
                        ((UPTODATE++))
                    else
                        echo -e "${GREEN}pushed${NC}"
                        ((PUSHED++))
                    fi
                else
                    echo -e "${RED}failed${NC}"
                    echo "    $output" | head -2
                    ((FAILED++))
                fi
            fi
        done
        echo ""
    done

    # Summary
    echo "==========================="
    echo -e "${BOLD}Summary${NC}"
    echo "  Repositories: $TOTAL"
    echo -e "  Pushed:       ${GREEN}$PUSHED${NC}"
    echo -e "  Up-to-date:   ${BLUE}$UPTODATE${NC}"
    if [[ $FAILED -gt 0 ]]; then
        echo -e "  Failed:       ${RED}$FAILED${NC}"
    fi
}

# Main
DRY_RUN=false

while [[ $# -gt 0 ]]; do
    case $1 in
        --dry-run)
            DRY_RUN=true
            shift
            ;;
        --status)
            show_status
            exit 0
            ;;
        --help|-h)
            usage
            exit 0
            ;;
        *)
            echo "Unknown option: $1"
            usage
            exit 1
            ;;
    esac
done

# Check ssh-agent
if ! ssh-add -l &>/dev/null; then
    echo -e "${YELLOW}Warning: No SSH keys loaded in agent${NC}"
    echo "Run: ssh-add ~/.ssh/id_ed25519_gitea ~/.ssh/id_ed25519_gitlab ~/.ssh/id_ed25519"
    echo ""
fi

push_all "$DRY_RUN"

Quick Git Commands

Common git operations across domus repos.

Check All Repos Status

for repo in ~/atelier/_bibliotheca/domus-*/; do
  echo "=== $(basename $repo) ==="
  git -C "$repo" status --short
done

Pull All Repos

for repo in ~/atelier/_bibliotheca/domus-*/; do
  echo "=== $(basename $repo) ==="
  git -C "$repo" pull --rebase
done

Show Latest Commit Per Repo

for repo in ~/atelier/_bibliotheca/domus-*/; do
  echo "$(basename $repo): $(git -C "$repo" log --oneline -1)"
done

Build & Deploy Commands

Build and Deploy Docs

# From domus-docs directory
cd ~/atelier/_bibliotheca/domus-docs

# Build locally
make local

# Deploy to Cloudflare Pages
wrangler pages deploy build/site --project-name=domus-docs

Build and Deploy UI Bundle

# From domus-antora-ui directory
cd ~/atelier/_bibliotheca/domus-antora-ui

# Build bundle
npx gulp bundle

# Deploy to Cloudflare Pages
wrangler pages deploy build --project-name=domus-ui

Full Deploy Workflow

# 1. Build docs
cd ~/atelier/_bibliotheca/domus-docs && make local

# 2. Deploy docs
wrangler pages deploy build/site --project-name=domus-docs

# 3. Purge CDN cache
netapi cloudflare purge domusdigitalis.dev -y
  • Antora UI Architecture (infra-ops)

  • Cloudflare Commands (netapi)