diff --git a/.gitfield/push_log.json b/.gitfield/push_log.json index d3f979d..06e78e7 100644 --- a/.gitfield/push_log.json +++ b/.gitfield/push_log.json @@ -62,6 +62,12 @@ "branch": "master", "commit": "87be8e1f1a32571a9b9fadc8884e60735e0534c8", "message": "Post-GitHub sync at 2025-06-06 05:49:34" + }, + { + "timestamp": "2025-06-06 06:21:43", + "branch": "master", + "commit": "f9a30495fd65bed41ba4e7de8e7443dd777c98c7", + "message": "Post-GitHub sync at 2025-06-06 05:49:34" } ] } diff --git a/.gitfield/pushed.log b/.gitfield/pushed.log index 8bb7d08..725e6fb 100644 --- a/.gitfield/pushed.log +++ b/.gitfield/pushed.log @@ -67,3 +67,4 @@ [2025-06-06 05:51:51] GitLab: https://gitlab.com/mrhavens/git-sigil [2025-06-06 05:52:14] Bitbucket: https://bitbucket.org/thefoldwithin/git-sigil [2025-06-06 05:52:26] GitHub: https://github.com/mrhavens/git-sigil +[2025-06-06 06:21:44] Local: diff --git a/bin/gitfield-sync b/bin/gitfield-sync index ef0da39..4b07642 100755 --- a/bin/gitfield-sync +++ b/bin/gitfield-sync @@ -109,11 +109,11 @@ The following platforms host the \`$REPO_NAME\` repository, each chosen for its ### 2. Forgejo - **URL**: [$FORGEJO_URL]($FORGEJO_URL) -- **Purpose**: Forgejo is a self-hosted, open-source git platform running on \`remember.thefoldwithin.earth\` (user: \`mrhavens\`, SSH port: 222). It provides full control over the repository, ensuring sovereignty and independence from third-party providers. +- **Purpose**: Forgejo is a self-hosted, open-source git platform running on \`remember.thefoldwithin.earth\`. It provides full control over the repository, ensuring sovereignty and independence from third-party providers. - **Value**: Enhances resilience by hosting the repository on a sovereign, redundant system with automated backups and deployment strategies, reducing risks of external interference or service disruptions. - **Access Details**: SSH access uses port 222: \`\`\`bash - ssh -T -p 222 git@remember.thefoldwithin.earth + ssh -T -p 222 username@remember.thefoldwithin.earth \`\`\` ### 3. GitLab diff --git a/bin/gitfield-sync-bak b/bin/gitfield-sync-bak deleted file mode 100755 index eed4cb9..0000000 --- a/bin/gitfield-sync-bak +++ /dev/null @@ -1,233 +0,0 @@ -#!/bin/bash -set -euo pipefail -IFS=$'\n\t' - -# ╭─────────────────────────────────────╮ -# │ CONFIGURATION │ -# ╰─────────────────────────────────────╮ -REPO_PATH=$(git rev-parse --show-toplevel 2>/dev/null) || error "Not inside a Git repository" -REPO_NAME=$(basename "$REPO_PATH") -GITFIELD_DIR="$REPO_PATH/.gitfield" -LOG_FILE="$GITFIELD_DIR/pushed.log" -GITFIELD_MD="$REPO_PATH/GITFIELD.md" -TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') -SCRIPT_VERSION="1.0" - -# URLs for each platform (derived from existing scripts) -GITHUB_URL="https://github.com/mrhavens/$REPO_NAME" -GITLAB_URL="https://gitlab.com/mrhavens/$REPO_NAME" -BITBUCKET_URL="https://bitbucket.org/thefoldwithin/$REPO_NAME" -RADICLE_RID="rad:z3FEj7rF8gZw9eFksCuiN43qjzrex" -RADICLE_PEER_ID="z6Mkw5s3ppo26C7y7tGK5MD8n2GqTHS582PPpeX5Xqbu2Mpz" - -# ╭─────────────────────────────────────╮ -# │ LOGGING UTILS │ -# ╰─────────────────────────────────────╮ -info() { echo -e "\e[1;34m[INFO]\e[0m $*" >&2; } -warn() { echo -e "\e[1;33m[WARN]\e[0m $*" >&2; } -error() { echo -e "\e[1;31m[ERROR]\e[0m $*" >&2; exit 1; } - -# ╭─────────────────────────────────────╮ -# │ SCRIPT LOOKUP FUNCTION │ -# ╰─────────────────────────────────────╮ -find_script() { - local script_name=$1 - local search_paths=( - "$HOME/.local/gitfieldbin" - "$HOME/.local/bin" - "$HOME/.local/gitfield" - "$HOME/.local/bin/gitfield" - "$HOME/.local/bin/gitfieldbin" - ) - - for path in "${search_paths[@]}"; do - if [ -f "$path/$script_name" ]; then - if [ -x "$path/$script_name" ]; then - if [[ "$path" != "$HOME"* ]]; then - info "Using script: \e[1;31m$path/$script_name\e[0m (outside home directory)" - else - info "Using script: $path/$script_name" - fi - echo "$path/$script_name" - return 0 - else - warn "Found $path/$script_name but it is not executable" - fi - fi - done - error "Script $script_name not found in any search path" -} - -# ╭─────────────────────────────────────╮ -# │ INITIAL SETUP │ -# ╰─────────────────────────────────────╮ -mkdir -p "$GITFIELD_DIR" - -if [ ! -f "$LOG_FILE" ]; then - echo "# Push Log for $REPO_NAME" > "$LOG_FILE" - echo "# Generated by gitfield-sync" >> "$LOG_FILE" - echo "" >> "$LOG_FILE" -fi - -# ╭─────────────────────────────────────╮ -# │ GENERATE GITFIELD.MD │ -# ╰─────────────────────────────────────╮ -generate_gitfield_md() { - info "Generating $GITFIELD_MD..." - cat > "$GITFIELD_MD" <> "$LOG_FILE" - echo " CLI: rad inspect $rid # View project details" >> "$LOG_FILE" - echo " CLI: git ls-tree -r --name-only HEAD # View file structure" >> "$LOG_FILE" - info "Logged push to $LOG_FILE: [$timestamp] $platform: RID=$rid, Peer ID=$peer_id" - else - echo "[$timestamp] $platform: $url" >> "$LOG_FILE" - info "Logged push to $LOG_FILE: [$timestamp] $platform: $url" - fi -} - -# ╭─────────────────────────────────────╮ -# │ EXECUTE PUSH SCRIPT │ -# ╰─────────────────────────────────────╮ -execute_push() { - local script_name=$1 - local platform=$2 - local url=$3 - local rid=$4 - local peer_id=$5 - local script_path - script_path=$(find_script "$script_name") || error "Failed to find $script_name" - info "Executing $platform push with script: $script_path" - if [ -x "$script_path" ]; then - pushd "$REPO_PATH" >/dev/null - "$script_path" || warn "Execution of $script_path failed, continuing..." - log_url "$platform" "$url" "$rid" "$peer_id" - git add . || warn "Nothing to add after $script_path" - git commit -m "Post-$platform sync at $TIMESTAMP" || warn "No changes to commit after $script_path" - popd >/dev/null - else - error "Script $script_path is not executable" - fi -} - -# ╭─────────────────────────────────────╮ -# │ RECURSIVE PUSH LOOP │ -# ╰─────────────────────────────────────╮ -run_push_cycle() { - local cycle_number=$1 - info "Starting push cycle $cycle_number..." - - execute_push "gitfield-local" "Local" "" "" "" - execute_push "gitfield-radicle" "Radicle" "" "$RADICLE_RID" "$RADICLE_PEER_ID" - execute_push "gitfield-gitlab" "GitLab" "$GITLAB_URL" "" "" - execute_push "gitfield-bitbucket" "Bitbucket" "$BITBUCKET_URL" "" "" - execute_push "gitfield-github" "GitHub" "$GITHUB_URL" "" "" -} - -# ╭─────────────────────────────────────╮ -# │ MAIN EXECUTION │ -# ╰─────────────────────────────────────╮ -info "Starting gitfield-sync for $REPO_NAME..." - -if [ ! -d "$REPO_PATH/.git" ]; then - pushd "$REPO_PATH" >/dev/null - git init - git add . - git commit -m "Initial commit" || warn "Nothing to commit" - popd >/dev/null -fi - -run_push_cycle 1 -generate_gitfield_md -run_push_cycle 2 -run_push_cycle 3 - -info "✅ gitfield-sync completed successfully." -info "🔗 View logs: $LOG_FILE" -info "🔗 View multi-repo manifest: $GITFIELD_MD"