From a463ef36be357048dcaea43e32d668321b6e9903 Mon Sep 17 00:00:00 2001 From: Mark Randall Havens Date: Wed, 11 Jun 2025 18:41:37 -0500 Subject: [PATCH] Post-Radicle sync at 2025-06-11T23:29:59Z --- .gitfield/pushed.log | 7 +++ bin/rad-info.sh | 104 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 111 insertions(+) create mode 100755 bin/rad-info.sh diff --git a/.gitfield/pushed.log b/.gitfield/pushed.log index 1a6abf2..fb60613 100644 --- a/.gitfield/pushed.log +++ b/.gitfield/pushed.log @@ -734,3 +734,10 @@ Diff Summary: .gitfield/local.sigil.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) +[2025-06-11T23:41:37Z] Radicle: RID=rad:z3FEj7rF8gZw9eFksCuiN43qjzrex, Peer ID=z6Mkw5s3ppo26C7y7tGK5MD8n2GqTHS582PPpeX5Xqbu2Mpz, Branch=master, Commit=abfc644 + CLI: rad inspect rad:z3FEj7rF8gZw9eFksCuiN43qjzrex # View project details + CLI: git ls-tree -r --name-only HEAD # View file structure + Diff Summary: + .gitfield/push_log.json | 6 ++++++ + .gitfield/pushed.log | 4 ++++ + 2 files changed, 10 insertions(+) diff --git a/bin/rad-info.sh b/bin/rad-info.sh new file mode 100755 index 0000000..9bdec71 --- /dev/null +++ b/bin/rad-info.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +# Exit on error +set -e + +# Check if we're in a Git repository +if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "Error: Not inside a Git repository" + exit 1 +fi + +# Check for required tools +for cmd in git rad jq; do + if ! command -v "$cmd" >/dev/null 2>&1; then + echo "Error: $cmd is required but not installed" + exit 1 + fi +done + +# Ensure rad is initialized for the repository +if ! rad inspect >/dev/null 2>&1; then + echo "Error: This repository is not initialized with Radicle. Run 'rad init' first." + exit 1 +fi + +# Get repository details using rad commands +REPO_RID=$(rad inspect --rid 2>/dev/null | grep -o 'rad:[a-zA-Z0-9]\+' || echo "N/A") +if [ "$REPO_RID" == "N/A" ]; then + echo "Error: Could not retrieve Repository ID (RID)" + exit 1 +fi + +# Get repository name and visibility +REPO_INFO=$(rad inspect --json 2>/dev/null | jq -r '.name, .visibility.type' || echo "N/A N/A") +read REPO_NAME VISIBILITY <<< "$REPO_INFO" +if [ "$REPO_NAME" == "N/A" ]; then + echo "Error: Could not retrieve repository name" + exit 1 +fi + +# Get user identity (DID and NID) +USER_INFO=$(rad self --json 2>/dev/null | jq -r '.did, .nid' || echo "N/A N/A") +read DID NID <<< "$USER_INFO" +if [ "$DID" == "N/A" ]; then + echo "Error: Could not retrieve user identity (DID)" + exit 1 +fi + +# Get preferred seed nodes from config +PREFERRED_SEEDS=$(rad config --json 2>/dev/null | jq -r '.preferredSeeds[]' | tr '\n' ',' | sed 's/,$//') +if [ -z "$PREFERRED_SEEDS" ]; then + PREFERRED_SEEDS="None configured" +fi + +# Get local repository details +DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || echo "main") +CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "N/A") +CURRENT_COMMIT=$(git rev-parse HEAD 2>/dev/null || echo "N/A") +REPO_STATUS=$(git status --porcelain 2>/dev/null | wc -l | xargs) +if [ "$REPO_STATUS" -eq 0 ]; then + REPO_STATUS="Clean" +else + REPO_STATUS="Dirty ($REPO_STATUS uncommitted changes)" +fi + +# Get sync status (peers seeding the repo) +SYNC_STATUS=$(rad sync status --json 2>/dev/null | jq -r '.peers[]?.node' | tr '\n' ',' | sed 's/,$//' || echo "No peers found") +if [ -z "$SYNC_STATUS" ]; then + SYNC_STATUS="No peers found" +fi + +# Get web view URL (if public) +if [ "$VISIBILITY" == "public" ]; then + PUBLIC_EXPLORER=$(rad config --json | jq -r '.publicExplorer' | sed "s@\\\$host@seed.radicle.garden@g;s@\\\$rid@$REPO_RID@g;s@\\\$path@@g") +else + PUBLIC_EXPLORER="N/A (Private repository)" +fi + +# Output repository information +cat <