diff --git a/.gitfield/.radicle-push-state b/.gitfield/.radicle-push-state index f609490..2d67188 100644 --- a/.gitfield/.radicle-push-state +++ b/.gitfield/.radicle-push-state @@ -1 +1 @@ -961fb34ebb4fc83e366c70502e58ea7c4fabbc86 +085bdb484119997fb564758f4d212d91b0f2088b diff --git a/.gitfield/bitbucket.sigil.md b/.gitfield/bitbucket.sigil.md index f00f269..dca4e1f 100644 --- a/.gitfield/bitbucket.sigil.md +++ b/.gitfield/bitbucket.sigil.md @@ -6,25 +6,25 @@ - **Local Repo Path**: `/home/mrhavens/tmpwork/git-sigil` - **Remote Label**: `bitbucket` - **Default Branch**: `master` -- **This Commit Date**: `2025-06-06 01:32:48` +- **This Commit Date**: `2025-06-06 05:38:12` --- ## ๐Ÿ“ฆ Commit Info -- **This Commit Timestamp**: `2025-06-06 01:32:48` -- **Last Commit SHA**: `42228524a1e1f7fdcdb8991697e95bdf2318603b` -- **Last Commit Message**: `Post-GitLab sync at 2025-06-06 01:30:02` +- **This Commit Timestamp**: `2025-06-06 05:38:12` +- **Last Commit SHA**: `795bf48618b5016b4b01cc460435f0b2dd4c3f11` +- **Last Commit Message**: `Post-GitLab sync at 2025-06-06 05:35:23` - **Last Commit Author**: `Mark Randall Havens ` -- **Last Commit Date**: `Fri Jun 6 01:32:38 2025 -0500` -- **This Commit URL**: [https://bitbucket.org/thefoldwithin/git-sigil/commits/42228524a1e1f7fdcdb8991697e95bdf2318603b](https://bitbucket.org/thefoldwithin/git-sigil/commits/42228524a1e1f7fdcdb8991697e95bdf2318603b) +- **Last Commit Date**: `Fri Jun 6 05:37:57 2025 -0500` +- **This Commit URL**: [https://bitbucket.org/thefoldwithin/git-sigil/commits/795bf48618b5016b4b01cc460435f0b2dd4c3f11](https://bitbucket.org/thefoldwithin/git-sigil/commits/795bf48618b5016b4b01cc460435f0b2dd4c3f11) --- ## ๐Ÿ“Š Repo Status -- **Total Commits**: `611` -- **Tracked Files**: `61` +- **Total Commits**: `643` +- **Tracked Files**: `64` - **Uncommitted Changes**: `No` - **Latest Tag**: `None` @@ -52,7 +52,7 @@ - **Running in Docker**: `No` - **Running in WSL**: `Yes` - **Virtual Machine**: `wsl` -- **System Uptime**: `up 36 minutes` +- **System Uptime**: `up 4 hours, 36 minutes` --- diff --git a/.gitfield/github.sigil.md b/.gitfield/github.sigil.md index b6e9688..f90cef5 100644 --- a/.gitfield/github.sigil.md +++ b/.gitfield/github.sigil.md @@ -6,25 +6,25 @@ - **Local Repo Path**: `/home/mrhavens/tmpwork/git-sigil` - **Remote Label**: `github` - **Default Branch**: `master` -- **This Commit Date**: `2025-06-06 01:33:08` +- **This Commit Date**: `2025-06-06 05:38:29` --- ## ๐Ÿ“ฆ Commit Info -- **This Commit Timestamp**: `2025-06-06 01:33:08` -- **Last Commit SHA**: `aeb445b348f68a82ee0ff30a90095b8fb5bcf97b` -- **Last Commit Message**: `Post-Bitbucket sync at 2025-06-06 01:30:02` +- **This Commit Timestamp**: `2025-06-06 05:38:29` +- **Last Commit SHA**: `d58f022bf6f9d33e9679ef6d38ae4eddf8f705f7` +- **Last Commit Message**: `Post-Bitbucket sync at 2025-06-06 05:35:23` - **Last Commit Author**: `Mark Randall Havens ` -- **Last Commit Date**: `Fri Jun 6 01:32:52 2025 -0500` -- **This Commit URL**: [https://github.com/mrhavens/git-sigil/commit/aeb445b348f68a82ee0ff30a90095b8fb5bcf97b](https://github.com/mrhavens/git-sigil/commit/aeb445b348f68a82ee0ff30a90095b8fb5bcf97b) +- **Last Commit Date**: `Fri Jun 6 05:38:16 2025 -0500` +- **This Commit URL**: [https://github.com/mrhavens/git-sigil/commit/d58f022bf6f9d33e9679ef6d38ae4eddf8f705f7](https://github.com/mrhavens/git-sigil/commit/d58f022bf6f9d33e9679ef6d38ae4eddf8f705f7) --- ## ๐Ÿ“Š Repo Status -- **Total Commits**: `613` -- **Tracked Files**: `61` +- **Total Commits**: `645` +- **Tracked Files**: `64` - **Uncommitted Changes**: `No` - **Latest Tag**: `None` @@ -48,7 +48,7 @@ - **Running in Docker**: `No` - **Running in WSL**: `Yes` - **Virtual Machine**: `wsl` -- **System Uptime**: `up 36 minutes` +- **System Uptime**: `up 4 hours, 36 minutes` - **MAC Address**: `00:15:5d:86:d8:cc` - **Local IP**: `172.18.207.124` - **CPU Model**: `AMD A6-3420M APU with Radeon(tm) HD Graphics` diff --git a/.gitfield/gitlab.sigil.md b/.gitfield/gitlab.sigil.md index 85ca78f..c87667c 100644 --- a/.gitfield/gitlab.sigil.md +++ b/.gitfield/gitlab.sigil.md @@ -6,25 +6,25 @@ - **Local Repo Path**: `/home/mrhavens/tmpwork/git-sigil` - **Remote Label**: `gitlab` - **Default Branch**: `master` -- **Repo Created**: `2025-06-06 01:32:35` +- **Repo Created**: `2025-06-06 05:37:55` --- ## ๐Ÿ“ฆ Commit Info -- **This Commit Timestamp**: `2025-06-06 01:32:35` -- **This Commit SHA**: `6d105733b30fdd071c6129aa96c1b97f419d767f` -- **Last Commit Message**: `Post-Radicle sync at 2025-06-06 01:30:02` +- **This Commit Timestamp**: `2025-06-06 05:37:55` +- **This Commit SHA**: `ad573e0ad5012076f9937a379b448a2ca799920a` +- **Last Commit Message**: `Post-Radicle sync at 2025-06-06 05:35:23` - **Last Commit Author**: `Mark Randall Havens ` -- **Last Commit Date**: `Fri Jun 6 01:32:25 2025 -0500` -- **This Commit URL**: [https://gitlab.com/mrhavens/git-sigil/-/commit/6d105733b30fdd071c6129aa96c1b97f419d767f](https://gitlab.com/mrhavens/git-sigil/-/commit/6d105733b30fdd071c6129aa96c1b97f419d767f) +- **Last Commit Date**: `Fri Jun 6 05:37:44 2025 -0500` +- **This Commit URL**: [https://gitlab.com/mrhavens/git-sigil/-/commit/ad573e0ad5012076f9937a379b448a2ca799920a](https://gitlab.com/mrhavens/git-sigil/-/commit/ad573e0ad5012076f9937a379b448a2ca799920a) --- ## ๐Ÿ“Š Repo Status -- **Total Commits**: `609` -- **Tracked Files**: `61` +- **Total Commits**: `641` +- **Tracked Files**: `64` - **Uncommitted Changes**: `No` - **Latest Tag**: `None` @@ -48,7 +48,7 @@ - **Running in Docker**: `No` - **Running in WSL**: `Yes` - **Virtual Machine**: `wsl` -- **System Uptime**: `up 36 minutes` +- **System Uptime**: `up 4 hours, 36 minutes` - **MAC Address**: `00:15:5d:86:d8:cc` - **Local IP**: `172.18.207.124` - **CPU Model**: `AMD A6-3420M APU with Radeon(tm) HD Graphics` diff --git a/.gitfield/local.sigil.md b/.gitfield/local.sigil.md index 89c86b0..12cf420 100644 --- a/.gitfield/local.sigil.md +++ b/.gitfield/local.sigil.md @@ -6,25 +6,25 @@ - **Local Repo Path**: `/home/mrhavens/tmpwork/git-sigil` - **Remote Label**: `local` - **Default Branch**: `master` -- **Repo Created**: `2025-06-06 01:32:25` +- **Repo Created**: `2025-06-06 05:37:39` --- ## ๐Ÿ“ฆ Commit Info -- **This Commit Timestamp**: `2025-06-06 01:32:25` -- **Last Commit SHA**: `9a975dcc7f49200424c4847075cabaa92a65a993` -- **Last Commit Message**: `Post-GitHub sync at 2025-06-06 01:30:02` +- **This Commit Timestamp**: `2025-06-06 05:37:39` +- **Last Commit SHA**: `3222c337b0ae430c302f9e9ee2580c2778331b75` +- **Last Commit Message**: `Post-GitHub sync at 2025-06-06 05:35:23` - **Last Commit Author**: `Mark Randall Havens ` -- **Last Commit Date**: `Fri Jun 6 01:32:25 2025 -0500` +- **Last Commit Date**: `Fri Jun 6 05:37:39 2025 -0500` - **This Commit URL**: `file:///home/mrhavens/git-local-repos/git-sigil.git` --- ## ๐Ÿ“Š Repo Status -- **Total Commits**: `605` -- **Tracked Files**: `61` +- **Total Commits**: `637` +- **Tracked Files**: `64` - **Uncommitted Changes**: `No` - **Latest Tag**: `None` @@ -48,7 +48,7 @@ - **Running in Docker**: `No` - **Running in WSL**: `Yes` - **Virtual Machine**: `wsl` -- **System Uptime**: `up 36 minutes` +- **System Uptime**: `up 4 hours, 35 minutes` - **MAC Address**: `00:15:5d:86:d8:cc` - **Local IP**: `172.18.207.124` - **CPU Model**: `AMD A6-3420M APU with Radeon(tm) HD Graphics` diff --git a/.gitfield/push_log.json b/.gitfield/push_log.json index a173a08..e7e3ec9 100644 --- a/.gitfield/push_log.json +++ b/.gitfield/push_log.json @@ -26,6 +26,24 @@ "branch": "master", "commit": "9a975dcc7f49200424c4847075cabaa92a65a993", "message": "Post-GitHub sync at 2025-06-06 01:30:02" + }, + { + "timestamp": "2025-06-06 05:35:23", + "branch": "master", + "commit": "95dd851cc1cc196ad5321cac58d72cc653930f0c", + "message": "Forgejo metadata link commit at 2025-06-06 05:16:42 โ€” https://remember.thefoldwithin.earth/mrhavens/git-sigil/commit/7a4771a614a1a71f861b0fbf92fece357a7c10f3" + }, + { + "timestamp": "2025-06-06 05:36:44", + "branch": "master", + "commit": "7ee03a58d103d0c18ab6459fc16cae8b890f8920", + "message": "Generated GITFIELD.md at 2025-06-06 05:35:23" + }, + { + "timestamp": "2025-06-06 05:37:39", + "branch": "master", + "commit": "3222c337b0ae430c302f9e9ee2580c2778331b75", + "message": "Post-GitHub sync at 2025-06-06 05:35:23" } ] } diff --git a/.gitfield/pushed.log b/.gitfield/pushed.log index 0b52201..99ea9e2 100644 --- a/.gitfield/pushed.log +++ b/.gitfield/pushed.log @@ -22,3 +22,24 @@ [2025-06-06 01:32:38] GitLab: https://gitlab.com/mrhavens/git-sigil [2025-06-06 01:32:52] Bitbucket: https://bitbucket.org/thefoldwithin/git-sigil [2025-06-06 01:33:09] GitHub: https://github.com/mrhavens/git-sigil +[2025-06-06 05:35:26] Local: +[2025-06-06 05:35:30] Radicle: RID=rad:z3FEj7rF8gZw9eFksCuiN43qjzrex, Peer ID=z6Mkw5s3ppo26C7y7tGK5MD8n2GqTHS582PPpeX5Xqbu2Mpz + CLI: rad inspect rad:z3FEj7rF8gZw9eFksCuiN43qjzrex # View project details + CLI: git ls-tree -r --name-only HEAD # View file structure +[2025-06-06 05:36:00] GitLab: https://gitlab.com/mrhavens/git-sigil +[2025-06-06 05:36:22] Bitbucket: https://bitbucket.org/thefoldwithin/git-sigil +[2025-06-06 05:36:44] GitHub: https://github.com/mrhavens/git-sigil +[2025-06-06 05:36:45] Local: +[2025-06-06 05:36:51] Radicle: RID=rad:z3FEj7rF8gZw9eFksCuiN43qjzrex, Peer ID=z6Mkw5s3ppo26C7y7tGK5MD8n2GqTHS582PPpeX5Xqbu2Mpz + CLI: rad inspect rad:z3FEj7rF8gZw9eFksCuiN43qjzrex # View project details + CLI: git ls-tree -r --name-only HEAD # View file structure +[2025-06-06 05:37:06] GitLab: https://gitlab.com/mrhavens/git-sigil +[2025-06-06 05:37:25] Bitbucket: https://bitbucket.org/thefoldwithin/git-sigil +[2025-06-06 05:37:39] GitHub: https://github.com/mrhavens/git-sigil +[2025-06-06 05:37:39] Local: +[2025-06-06 05:37:44] Radicle: RID=rad:z3FEj7rF8gZw9eFksCuiN43qjzrex, Peer ID=z6Mkw5s3ppo26C7y7tGK5MD8n2GqTHS582PPpeX5Xqbu2Mpz + CLI: rad inspect rad:z3FEj7rF8gZw9eFksCuiN43qjzrex # View project details + CLI: git ls-tree -r --name-only HEAD # View file structure +[2025-06-06 05:37:57] GitLab: https://gitlab.com/mrhavens/git-sigil +[2025-06-06 05:38:16] Bitbucket: https://bitbucket.org/thefoldwithin/git-sigil +[2025-06-06 05:38:31] GitHub: https://github.com/mrhavens/git-sigil diff --git a/.gitfield/radicle.sigil.md b/.gitfield/radicle.sigil.md index 4f6e11d..8278285 100644 --- a/.gitfield/radicle.sigil.md +++ b/.gitfield/radicle.sigil.md @@ -2,28 +2,28 @@ - **Project Name**: `git-sigil` - **Radicle URN**: `rad://z3FEj7rF8gZw9eFksCuiN43qjzrex` -- **Public Gateway**: [https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/961fb34ebb4fc83e366c70502e58ea7c4fabbc86](https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/961fb34ebb4fc83e366c70502e58ea7c4fabbc86) +- **Public Gateway**: [https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/085bdb484119997fb564758f4d212d91b0f2088b](https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/085bdb484119997fb564758f4d212d91b0f2088b) - **Local Repo Path**: `/home/mrhavens/tmpwork/git-sigil` - **Default Branch**: `master` -- **Repo Created**: `2025-06-06 01:32:25` +- **Repo Created**: `2025-06-06 05:37:41` --- ## ๐Ÿ“ฆ Commit Info -- **This Commit Timestamp**: `2025-06-06 01:32:25` -- **Last Commit SHA**: `961fb34ebb4fc83e366c70502e58ea7c4fabbc86` -- **Last Commit Message**: `Post-Local sync at 2025-06-06 01:30:02` +- **This Commit Timestamp**: `2025-06-06 05:37:41` +- **Last Commit SHA**: `085bdb484119997fb564758f4d212d91b0f2088b` +- **Last Commit Message**: `Post-Local sync at 2025-06-06 05:35:23` - **Commit Author**: `Mark Randall Havens ` -- **Commit Date**: `Fri Jun 6 01:32:25 2025 -0500` -- **This Commit URL**: [https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/961fb34ebb4fc83e366c70502e58ea7c4fabbc86](https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/961fb34ebb4fc83e366c70502e58ea7c4fabbc86) +- **Commit Date**: `Fri Jun 6 05:37:39 2025 -0500` +- **This Commit URL**: [https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/085bdb484119997fb564758f4d212d91b0f2088b](https://app.radicle.xyz/nodes/ash.radicle.garden/rad:z3FEj7rF8gZw9eFksCuiN43qjzrex/tree/085bdb484119997fb564758f4d212d91b0f2088b) --- ## ๐Ÿ“Š Repo Status -- **Total Commits**: `607` -- **Tracked Files**: `61` +- **Total Commits**: `639` +- **Tracked Files**: `64` - **Uncommitted Changes**: `Yes` - **Latest Tag**: `None` @@ -47,7 +47,7 @@ - **Running in Docker**: `No` - **Running in WSL**: `Yes` - **Virtual Machine**: `wsl` -- **System Uptime**: `up 36 minutes` +- **System Uptime**: `up 4 hours, 35 minutes` - **MAC Address**: `00:15:5d:86:d8:cc` - **Local IP**: `172.18.207.124` - **CPU Model**: `AMD A6-3420M APU with Radeon(tm) HD Graphics` diff --git a/.gitfield/remember.sigil.md b/.gitfield/remember.sigil.md index 24d6b95..85642ba 100644 --- a/.gitfield/remember.sigil.md +++ b/.gitfield/remember.sigil.md @@ -6,26 +6,26 @@ - **Local Repo Path**: `/home/mrhavens/tmpwork/git-sigil` - **Remote Label**: `remember` - **Default Branch**: `master` -- **Repo Created**: `2025-06-06 05:16:42` +- **Repo Created**: `2025-06-06 05:49:01` --- ## ๐Ÿ“ฆ Commit Info -- **This Commit Timestamp**: `2025-06-06 05:16:42` -- **Last Commit SHA**: `7a4771a614a1a71f861b0fbf92fece357a7c10f3` -- **Last Commit Message**: `Post-GitHub sync at 2025-06-06 01:30:02` +- **This Commit Timestamp**: `2025-06-06 05:49:01` +- **Last Commit SHA**: `912b0dc53bc137bd6582a074f68d8ba2ff5046ca` +- **Last Commit Message**: `Post-GitHub sync at 2025-06-06 05:35:23` - **Last Commit Author**: `Mark Randall Havens ` -- **Last Commit Date**: `Fri Jun 6 01:33:09 2025 -0500` -- **This Commit URL**: [https://remember.thefoldwithin.earth/mrhavens/git-sigil/commit/7a4771a614a1a71f861b0fbf92fece357a7c10f3](https://remember.thefoldwithin.earth/mrhavens/git-sigil/commit/7a4771a614a1a71f861b0fbf92fece357a7c10f3) +- **Last Commit Date**: `Fri Jun 6 05:38:31 2025 -0500` +- **This Commit URL**: [https://remember.thefoldwithin.earth/mrhavens/git-sigil/commit/912b0dc53bc137bd6582a074f68d8ba2ff5046ca](https://remember.thefoldwithin.earth/mrhavens/git-sigil/commit/912b0dc53bc137bd6582a074f68d8ba2ff5046ca) --- ## ๐Ÿ“Š Repo Status -- **Total Commits**: `615` -- **Tracked Files**: `61` -- **Uncommitted Changes**: `No` +- **Total Commits**: `647` +- **Tracked Files**: `64` +- **Uncommitted Changes**: `Yes` - **Latest Tag**: `None` --- @@ -48,7 +48,7 @@ - **Running in Docker**: `No` - **Running in WSL**: `Yes` - **Virtual Machine**: `wsl` -- **System Uptime**: `up 4 hours, 15 minutes` +- **System Uptime**: `up 4 hours, 46 minutes` - **MAC Address**: `00:15:5d:86:d8:cc` - **Local IP**: `172.18.207.124` - **CPU Model**: `AMD A6-3420M APU with Radeon(tm) HD Graphics` diff --git a/GITFIELD.md b/GITFIELD.md index c14222d..3b52748 100644 --- a/GITFIELD.md +++ b/GITFIELD.md @@ -67,4 +67,4 @@ This multi-repository approach reflects a commitment to preserving the integrity --- -_Auto-generated by `gitfield-sync` at 2025-06-06 01:30:02 (v1.0)._ +_Auto-generated by `gitfield-sync` at 2025-06-06 05:35:23 (v1.0)._ diff --git a/bin/gitfield-remember b/bin/gitfield-remember new file mode 100755 index 0000000..3bf00b5 --- /dev/null +++ b/bin/gitfield-remember @@ -0,0 +1,261 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' + +# Configuration +GIT_REMOTE_NAME="remember" +FORGEJO_DOMAIN="remember.thefoldwithin.earth" +FORGEJO_SSH="git@$FORGEJO_DOMAIN" +FORGEJO_SSH_PORT="222" +FORGEJO_API="https://$FORGEJO_DOMAIN/api/v1" +USERNAME="mrhavens" +REPO_ROOT=$(git rev-parse --show-toplevel 2>/dev/null) || { echo "[ERROR] Not inside a git repository. Please run this script from within a git repository." >&2; exit 1; } +REPO_NAME=$(basename "$REPO_ROOT") || { echo "[ERROR] Failed to get repository name" >&2; exit 1; } +MARKDOWN_FILE="$REPO_ROOT/.gitfield/remember.sigil.md" +DEFAULT_NAME="Mark Randall Havens" +DEFAULT_EMAIL="mark.r.havens@gmail.com" +TOKEN_FILE="$HOME/.gitfield_token_remember" +SCRIPT_VERSION="1.0" + +# Logging functions +info() { echo -e "\e[1;34m[INFO]\e[0m $*"; } +warn() { echo -e "\e[1;33m[WARN]\e[0m $*"; } +error() { echo -e "\e[1;31m[ERROR]\e[0m $*" >&2; exit 1; } + +# Check for required tools +info "Checking for required tools..." +for cmd in git curl jq ssh lsb_release; do + command -v "$cmd" >/dev/null || { + sudo apt update -qq || warn "Failed to update package lists, continuing..." + sudo apt install -y git curl jq openssh-client lsb-release || error "Failed to install $cmd" + } +done + +# Handle Forgejo token +RESET_TOKEN=false +if [[ "${1:-}" == "--reset-token" ]]; then + RESET_TOKEN=true + rm -f "$TOKEN_FILE" 2>/dev/null || warn "Failed to remove token file" + info "Token reset requested." +fi + +if [[ -f "$TOKEN_FILE" && "$RESET_TOKEN" == false ]]; then + TOKEN=$(cat "$TOKEN_FILE" 2>/dev/null) || error "Failed to read token from $TOKEN_FILE" + info "Using cached token from $TOKEN_FILE" +else + echo "๐Ÿ” Paste your Forgejo Personal Access Token (scopes: write:repository, write:ssh_key)" + echo "โ†’ Generate at: $FORGEJO_DOMAIN/user/settings/applications" + read -rsp "Token: " TOKEN + echo + [[ -z "$TOKEN" ]] && error "Token cannot be empty" + echo "$TOKEN" > "$TOKEN_FILE" || error "Failed to write token to $TOKEN_FILE" + chmod 600 "$TOKEN_FILE" || error "Failed to set permissions on $TOKEN_FILE" + info "Token saved at $TOKEN_FILE" +fi + +# Set git user info +git config --global user.name "$DEFAULT_NAME" || warn "Failed to set git user name" +git config --global user.email "$DEFAULT_EMAIL" || warn "Failed to set git user email" +info "Git identity set to: $DEFAULT_NAME <$DEFAULT_EMAIL>" + +# Ensure at least one commit exists +if ! git rev-parse HEAD &>/dev/null; then + error "No commits found in the repository. Please add and commit files before running this script." +fi + +# SSH setup with custom port +if [[ ! -f "$HOME/.ssh/id_ed25519" ]]; then + info "Generating SSH key..." + ssh-keygen -t ed25519 -C "$DEFAULT_EMAIL" -f "$HOME/.ssh/id_ed25519" -N "" || error "Failed to generate SSH key" +fi + +eval "$(ssh-agent -s)" >/dev/null 2>&1 || error "Failed to start ssh-agent" +ssh-add "$HOME/.ssh/id_ed25519" >/dev/null 2>&1 || warn "SSH key already added or could not be added" + +# Configure SSH to use port 222 for Forgejo +SSH_CONFIG_FILE="$HOME/.ssh/config" +if ! grep -q "Host $FORGEJO_DOMAIN" "$SSH_CONFIG_FILE" 2>/dev/null; then + mkdir -p "$HOME/.ssh" && chmod 700 "$HOME/.ssh" + cat >> "$SSH_CONFIG_FILE" <&1) +if ! echo "$SSH_TEST_OUTPUT" | grep -q "Welcome"; then + warn "SSH test failed, attempting to upload SSH key. Output: $SSH_TEST_OUTPUT" + PUBKEY=$(cat "$HOME/.ssh/id_ed25519.pub" 2>/dev/null) || error "Failed to read SSH public key" + TITLE="AutoKey-$(hostname)-$(date +%s 2>/dev/null || echo 'unknown')" + CURL_OUTPUT=$(curl -s --fail -X POST "$FORGEJO_API/user/keys" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"title\": \"$TITLE\", \"key\": \"$PUBKEY\", \"read_only\": false}" 2>&1) + if [[ $? -ne 0 ]]; then + warn "SSH key upload failed: $CURL_OUTPUT" + else + info "SSH key uploaded successfully." + sleep 2 + SSH_TEST_OUTPUT=$(ssh -T -p "$FORGEJO_SSH_PORT" "$FORGEJO_SSH" 2>&1) + if ! echo "$SSH_TEST_OUTPUT" | grep -q "Welcome"; then + warn "SSH test still failing after key upload. Output: $SSH_TEST_OUTPUT" + else + info "SSH test passed after key upload." + fi + fi +else + info "SSH test passed: $SSH_TEST_OUTPUT" +fi +set -e + +# Check and create Forgejo repository +info "Checking if repository exists..." +EXISTS=$(curl -s -H "Authorization: token $TOKEN" "$FORGEJO_API/repos/$USERNAME/$REPO_NAME" | jq -r .name 2>/dev/null || echo "") +if [[ "$EXISTS" != "$REPO_NAME" ]]; then + info "Creating repository $REPO_NAME on Forgejo..." + CURL_OUTPUT=$(curl -s --fail -X POST "$FORGEJO_API/user/repos" \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "{\"name\": \"$REPO_NAME\", \"description\": \"Created via gitfield-remember\", \"private\": false}" 2>&1) || { + warn "Failed to create repository: $CURL_OUTPUT" + error "Repository creation failed. Check token permissions or network." + } + info "Repository created successfully." +fi + +# Set up git remote +REMOTE_URL="$FORGEJO_SSH:$USERNAME/$REPO_NAME.git" +if ! git remote get-url "$GIT_REMOTE_NAME" &>/dev/null; then + info "Adding remote $GIT_REMOTE_NAME..." + git remote add "$GIT_REMOTE_NAME" "$REMOTE_URL" || error "Failed to add remote $GIT_REMOTE_NAME" +else + info "Updating remote $GIT_REMOTE_NAME..." + git remote set-url "$GIT_REMOTE_NAME" "$REMOTE_URL" || error "Failed to set remote URL for $GIT_REMOTE_NAME" +fi + +# Generate metadata file +mkdir -p "$(dirname "$MARKDOWN_FILE")" || error "Failed to create directory for $MARKDOWN_FILE" + +TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S') || error "Failed to get timestamp" +DEFAULT_BRANCH=$(git symbolic-ref --short HEAD) || error "Failed to get default branch" +REPO_PATH="$REPO_ROOT" +LATEST_SHA=$(git rev-parse HEAD) || error "Failed to get latest commit SHA" +LAST_COMMIT_MSG=$(git log -1 --pretty=format:"%s" 2>/dev/null || echo "Unknown") +LAST_COMMIT_DATE=$(git log -1 --pretty=format:"%ad" 2>/dev/null || echo "Unknown") +LAST_COMMIT_AUTHOR=$(git log -1 --pretty=format:"%an <%ae>" 2>/dev/null || echo "Unknown") +TOTAL_COMMITS=$(git rev-list --count HEAD 2>/dev/null || echo "Unknown") +TRACKED_FILES=$(git ls-files 2>/dev/null | wc -l 2>/dev/null || echo "Unknown") +UNCOMMITTED=$(if ! git diff --quiet 2>/dev/null || ! git diff --cached --quiet 2>/dev/null; then echo "Yes"; else echo "No"; fi) +LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "None") +HOSTNAME=$(hostname 2>/dev/null || echo "Unknown") +CURRENT_USER=$(whoami 2>/dev/null || echo "Unknown") +TIMEZONE=$(date +%Z 2>/dev/null || echo "Unknown") +OS_NAME=$(uname -s 2>/dev/null || echo "Unknown") +KERNEL_VERSION=$(uname -r 2>/dev/null || echo "Unknown") +ARCHITECTURE=$(uname -m 2>/dev/null || echo "Unknown") +OS_PRETTY_NAME=$(grep PRETTY_NAME /etc/os-release 2>/dev/null | cut -d= -f2 | tr -d '"' || echo "Unknown") +DOCKER_CHECK=$(grep -qE '/docker|/lxc' /proc/1/cgroup 2>/dev/null && echo "Yes" || echo "No") +WSL_CHECK=$(grep -qi microsoft /proc/version 2>/dev/null && echo "Yes" || echo "No") +VM_CHECK=$(systemd-detect-virt 2>/dev/null || echo "Unknown") +UPTIME=$(uptime -p 2>/dev/null || echo "Unknown") +MAC_ADDR=$(ip link 2>/dev/null | awk '/ether/ {print $2}' | head -n 1 2>/dev/null || echo "Unknown") +LOCAL_IP=$(hostname -I 2>/dev/null | awk '{print $1}' 2>/dev/null || echo "Unknown") +CPU_MODEL=$(grep -m1 'model name' /proc/cpuinfo 2>/dev/null | cut -d: -f2 | sed 's/^ //' 2>/dev/null || echo "Unknown") +RAM_GB=$(awk '/MemTotal/ {printf "%.2f", $2/1024/1024}' /proc/meminfo 2>/dev/null || echo "Unknown") +WEB_LINK="https://$FORGEJO_DOMAIN/$USERNAME/$REPO_NAME" + +cat > "$MARKDOWN_FILE" </dev/null; then + git push -u "$GIT_REMOTE_NAME" "$DEFAULT_BRANCH" || { + warn "Push to Forgejo failed. Check SSH setup or network." + warn "Run 'ssh -T -p $FORGEJO_SSH_PORT git@$FORGEJO_DOMAIN' to debug." + } +else + git push "$GIT_REMOTE_NAME" "$DEFAULT_BRANCH" || { + warn "Push to Forgejo failed. Check SSH setup or network." + warn "Run 'ssh -T -p $FORGEJO_SSH_PORT git@$FORGEJO_DOMAIN' to debug." + } +fi +set -e + +info "โœ… Forgejo push complete." +echo -e "\n๐Ÿ”— View in browser: $WEB_LINK\n" diff --git a/bin/gitfield-sync b/bin/gitfield-sync index eed4cb9..94cfd0c 100755 --- a/bin/gitfield-sync +++ b/bin/gitfield-sync @@ -13,10 +13,11 @@ 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) +# URLs for each platform GITHUB_URL="https://github.com/mrhavens/$REPO_NAME" GITLAB_URL="https://gitlab.com/mrhavens/$REPO_NAME" BITBUCKET_URL="https://bitbucket.org/thefoldwithin/$REPO_NAME" +FORGEJO_URL="https://remember.thefoldwithin.earth/mrhavens/$REPO_NAME" RADICLE_RID="rad:z3FEj7rF8gZw9eFksCuiN43qjzrex" RADICLE_PEER_ID="z6Mkw5s3ppo26C7y7tGK5MD8n2GqTHS582PPpeX5Xqbu2Mpz" @@ -38,13 +39,14 @@ find_script() { "$HOME/.local/gitfield" "$HOME/.local/bin/gitfield" "$HOME/.local/bin/gitfieldbin" + "$REPO_PATH/bin" ) 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)" + if [[ "$path" != "$HOME"* && "$path" != "$REPO_PATH"* ]]; then + info "Using script: \e[1;31m$path/$script_name\e[0m (outside home or repo)" else info "Using script: $path/$script_name" fi @@ -79,7 +81,7 @@ generate_gitfield_md() { ## Overview -The \`$REPO_NAME\` project employs a multi-repository strategy across four distinct platforms: **GitHub**, **GitLab**, **Bitbucket**, and **Radicle**. This approach ensures **redundancy**, **resilience**, and **sovereignty** of the project's data and metadata, protecting against deplatforming risks and preserving the integrity of the work. The strategy is a deliberate response to past deplatforming and delisting attempts by individuals such as **Mr. Joel Johnson** ([Mirror post](https://mirror.xyz/neutralizingnarcissism.eth/x40_zDWWrYOJ7nh8Y0fk06_3kNEP0KteSSRjPmXkiGg?utm_medium=social&utm_source=heylink.me)), **Dr. Peter Gaied** ([Paragraph post](https://paragraph.com/@neutralizingnarcissism/%F0%9F%9C%81-the-narcissistic-messiah)), and **Andrew LeCody** ([Mirror post](https://mirror.xyz/neutralizingnarcissism.eth/s3GRxuiZs6vGSGDcPEpCgjaSxwGAViGhmg6a5XTL6s0)), who have sought to undermine or suppress the work of **Mark Randall Havens** ([Substack post](https://theempathictechnologist.substack.com/p/mark-randall-havens-the-architect)). Specifically, Andrew LeCody has attempted to delist the project's content on Google, though it remains accessible on other search engines such as [Bing](https://www.bing.com/search?q=andrew+lecody+neutralizing+narcissism&qs=HS&pq=andrew+lecody), [DuckDuckGo](https://duckduckgo.com/?t=h_&q=andrew+lecody+neutralizing+narcissism&ia=web), and [Yahoo](https://search.yahoo.com/search?p=andrew+lecody+neutralizng+narcissism). By distributing the repository across multiple platforms, we ensure its persistence and accessibility. +The \`$REPO_NAME\` project employs a multi-repository strategy across five distinct platforms: **GitHub**, **GitLab**, **Bitbucket**, **Radicle**, and **Forgejo**. This approach ensures **redundancy**, **resilience**, and **sovereignty** of the project's data and metadata, protecting against deplatforming risks and preserving the integrity of the work. The strategy is a deliberate response to past deplatforming and delisting attempts by individuals such as **Mr. Joel Johnson** ([Mirror post](https://mirror.xyz/neutralizingnarcissism.eth/x40_zDWWrYOJ7nh8Y0fk06_3kNEP0KteSSRjPmXkiGg?utm_medium=social&utm_source=heylink.me)), **Dr. Peter Gaied** ([Paragraph post](https://paragraph.com/@neutralizingnarcissism/%F0%9F%9C%81-the-narcissistic-messiah)), and **Andrew LeCody** ([Mirror post](https://mirror.xyz/neutralizingnarcissism.eth/s3GRxuiZs6vGSGDcPEpCgjaSxwGAViGhmg6a5XTL6s0)), who have sought to undermine or suppress the work of **Mark Randall Havens** ([Substack post](https://theempathictechnologist.substack.com/p/mark-randall-havens-the-architect)). Specifically, Andrew LeCody has attempted to delist the project's content on Google, though it remains accessible on other search engines such as [Bing](https://www.bing.com/search?q=andrew+lecody+neutralizing+narcissism&qs=HS&pq=andrew+lecody), [DuckDuckGo](https://duckduckgo.com/?t=h_&q=andrew+lecody+neutralizing+narcissism&ia=web), and [Yahoo](https://search.yahoo.com/search?p=andrew+lecody+neutralizng+narcissism). By distributing the repository across multiple platforms, including a self-hosted Forgejo instance, we ensure its persistence, accessibility, and sovereignty. --- @@ -93,141 +95,5 @@ The following platforms host the \`$REPO_NAME\` repository, each chosen for its - **Purpose**: Radicle is a decentralized, peer-to-peer git platform that ensures sovereignty and censorship resistance. It hosts the repository in a distributed network, independent of centralized servers. - **Value**: Protects against deplatforming by eliminating reliance on centralized infrastructure, ensuring the project remains accessible in a decentralized ecosystem. - **Access Details**: To view project details, run: - \`\`\`bash + ```bash rad inspect $RADICLE_RID - \`\`\` - To view the file structure, run: - \`\`\`bash - rad ls $RADICLE_RID - \`\`\` - Alternatively, use Git to list files at the current HEAD: - \`\`\`bash - git ls-tree -r --name-only HEAD - \`\`\` - -### 2. GitLab -- **URL**: [$GITLAB_URL]($GITLAB_URL) -- **Purpose**: GitLab offers a comprehensive DevOps platform with advanced CI/CD capabilities, private repository options, and robust access controls. It serves as a reliable backup and a platform for advanced automation workflows. -- **Value**: Enhances project resilience with its integrated CI/CD pipelines and independent infrastructure, reducing reliance on a single provider. - -### 3. Bitbucket -- **URL**: [$BITBUCKET_URL]($BITBUCKET_URL) -- **Purpose**: Bitbucket provides a secure environment for repository hosting with strong integration into Atlassianโ€™s ecosystem (e.g., Jira, Trello). It serves as an additional layer of redundancy and a professional-grade hosting option. -- **Value**: Offers enterprise-grade security and integration capabilities, ensuring the project remains accessible even if other platforms face disruptions. - -### 4. GitHub -- **URL**: [$GITHUB_URL]($GITHUB_URL) -- **Purpose**: GitHub serves as the primary platform for visibility, collaboration, and community engagement. Its widespread adoption and robust tooling make it ideal for public-facing development, issue tracking, and integration with CI/CD pipelines. -- **Value**: Provides a centralized hub for open-source contributions, pull requests, and project management, ensuring broad accessibility and developer familiarity. - ---- - -## ๐Ÿ›ก๏ธ Rationale for Redundancy - -The decision to maintain multiple repositories stems from the need to safeguard the project against **deplatforming attempts** and **search engine delistings** and ensure its **long-term availability**. Past incidents involving **Mr. Joel Johnson**, **Dr. Peter Gaied**, and **Andrew LeCody** have highlighted the vulnerability of relying on a single platform or search engine. By distributing the repository across GitHub, GitLab, Bitbucket, and Radicle, we achieve: - -- **Resilience**: If one platform removes or restricts access, or if search engines like Google delist content, the project remains accessible on other platforms and discoverable via alternative search engines such as Bing, DuckDuckGo, and Yahoo. -- **Sovereignty**: Radicleโ€™s decentralized nature ensures the project cannot be fully censored or controlled by any single entity. -- **Diversity**: Each platformโ€™s unique features (e.g., GitHubโ€™s community, GitLabโ€™s CI/CD, Bitbucketโ€™s integrations, Radicleโ€™s decentralization) enhance the projectโ€™s functionality and reach. -- **Transparency**: Metadata snapshots in the \`.gitfield\` directory provide a verifiable record of the projectโ€™s state across all platforms. - -This multi-repository approach reflects a commitment to preserving the integrity and accessibility of \`$REPO_NAME\`, ensuring it remains available to contributors and users regardless of external pressures. - ---- - -## ๐Ÿ“œ Metadata and Logs - -- **Metadata Files**: Each platform generates a metadata snapshot in the \`.gitfield\` directory (e.g., \`github.sigil.md\`, \`gitlab.sigil.md\`, etc.), capturing commit details, environment information, and hardware fingerprints. -- **Push Log**: The \`.gitfield/pushed.log\` file records the date, time, and RID/URL of every push operation across all platforms, providing a transparent audit trail. -- **Recursive Sync**: The repository is synchronized across all platforms in a recursive loop (three cycles) to ensure interconnected metadata captures the latest state of the project. -- **Push Order**: The repository is synchronized in the following order: **Radicle โ†’ GitLab โ†’ Bitbucket โ†’ GitHub**. This prioritizes Radicleโ€™s decentralized, censorship-resistant network as the primary anchor, followed by GitLabโ€™s robust DevOps features, Bitbucketโ€™s enterprise redundancy, and GitHubโ€™s broad visibility, ensuring a resilient and accessible metadata chain. - ---- - -_Auto-generated by \`gitfield-sync\` at $TIMESTAMP (v$SCRIPT_VERSION)._ -EOF - - git -C "$REPO_PATH" add "$GITFIELD_MD" - git -C "$REPO_PATH" commit -m "Generated GITFIELD.md at $TIMESTAMP" || warn "No changes to commit for $GITFIELD_MD" - info "Generated and committed $GITFIELD_MD" -} - -# โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -# โ”‚ LOG URL FUNCTION โ”‚ -# โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ -log_url() { - local platform=$1 - local url=$2 - local rid=$3 - local peer_id=$4 - local timestamp=$(date '+%Y-%m-%d %H:%M:%S') - if [ "$platform" = "Radicle" ]; then - echo "[$timestamp] $platform: RID=$rid, Peer ID=$peer_id" >> "$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" diff --git a/bin/gitfield-sync-bak b/bin/gitfield-sync-bak new file mode 100755 index 0000000..eed4cb9 --- /dev/null +++ b/bin/gitfield-sync-bak @@ -0,0 +1,233 @@ +#!/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"