Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/ai-brain-core / update_starters.sh |
| Date | Not specified in source |
| Repository | Janady13/ai-brain-core |
| Revision | f7275582f13ada80bfb3b1008089800ca26f4a23 |
| Branch | main |
| Path or archive member | update_starters.sh |
| Original SHA-256 | a4542358c425aa0c757073a809678c763a035eabd794d349727941a8242beef0 |
| Git blob SHA | a574161c660f94e2760d6de1273d7740744ece82 |
| Reading-copy SHA-256 | a4542358c425aa0c757073a809678c763a035eabd794d349727941a8242beef0 |
Every recorded occurrence
These 3 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/ai-brain-core / update_starters.sh | main | f7275582f13ada80bfb3b1008089800ca26f4a23 | Open original |
| Janady13/ai-brain-core / update_starters.sh | claude/agi-architecture-diagram-01GJ7CohfKvLb77yiKpHqd6d | 365850e27004318edd582881225024026b118c2d | Open original |
| Janady13/ai-brain-core / update_starters.sh | healer-core | 0fe4cbbaa91912149f1a8e32205371ff67017268 | Open original |
Recovered source transcript
Download complete source text ↓94 lines · 3.0 KB
#!/usr/bin/env bash
# Safe updater for starter scripts (preview or apply)
# Usage:
# ./update_starters.sh # preview staged starter updates (no replace)
# ./update_starters.sh --apply # backup and replace current starters
set -euo pipefail
IFS=$'\n\t'
AI_BRAIN_DIR="${1:-$HOME/Desktop/AI_Brain}"
STAGE_DIR="$AI_BRAIN_DIR/.starter_updates"
BACKUP_ROOT="$AI_BRAIN_DIR/starter_backups"
TIMESTAMP="$(date +%Y%m%d%H%M%S)"
BACKUP_DIR="$BACKUP_ROOT/backup_$TIMESTAMP"
FILES=(start_all.sh start_adapter.sh start_orchestrator.sh stop_all.sh status_all.sh restart_all.sh)
# small guard to prevent accidental 'source' which can close your shell
if [ "${BASH_SOURCE[0]}" != "$0" ]; then
cat <<MSG >&2
ERROR: this script must be executed, not sourced.
Run it like: ./$(basename "$0")
Refusing to run to avoid closing your interactive shell.
MSG
return 1 2>/dev/null || exit 1
fi
mkdir -p "$STAGE_DIR" "$BACKUP_ROOT"
# Proposed updated content for starters (minimal safe template)
read -r -d '' STARTER_TEMPLATE <<'TEMPL'
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
AI_BRAIN_DIR="${1:-$HOME/Desktop/AI_Brain}"
LOG_DIR="$AI_BRAIN_DIR/logs"
mkdir -p "$LOG_DIR"
# Guard against being sourced
if [ "${BASH_SOURCE[0]}" != "$0" ]; then
echo "This script must be executed, not sourced." >&2
return 1 2>/dev/null || exit 1
fi
# Example detached start (no tmux required)
nohup bash -lc "cd '$AI_BRAIN_DIR' && python3 adapter/adapter.py >> '$LOG_DIR/adapter.log' 2>&1" >/dev/null 2>&1 &
nohup bash -lc "cd '$AI_BRAIN_DIR' && python3 orchestrator/orchestrator.py >> '$LOG_DIR/worker.log' 2>&1" >/dev/null 2>&1 &
echo "Start requested; scripts detached. Inspect logs in $LOG_DIR"
TEMPL
# write staged versions
for fname in "${FILES[@]}"; do
staged="$STAGE_DIR/$fname"
printf '%s\n' "$STARTER_TEMPLATE" > "$staged"
chmod 755 "$staged"
done
# show diffs / status
printf 'Staged updates written to: %s\n\n' "$STAGE_DIR"
for fname in "${FILES[@]}"; do
live="$AI_BRAIN_DIR/$fname"
staged="$STAGE_DIR/$fname"
if [ ! -f "$live" ]; then
printf "%-25s : %s\n" "$fname" "NEW (no existing file)"
else
if diff -q "$live" "$staged" >/dev/null 2>&1; then
printf "%-25s : %s\n" "$fname" "IDENTICAL"
else
printf "%-25s : %s\n" "$fname" "DIFFER (run --apply to replace)\n"
echo "---- diff for $fname ----"
diff -u "$live" "$staged" || true
echo "-------------------------"
fi
fi
done
if [ "${1:-}" = "--apply" ] || [ "${2:-}" = "--apply" ]; then
mkdir -p "$BACKUP_DIR"
for fname in "${FILES[@]}"; do
live="$AI_BRAIN_DIR/$fname"
staged="$STAGE_DIR/$fname"
if [ -f "$staged" ]; then
if [ -f "$live" ]; then
cp -p "$live" "$BACKUP_DIR/$fname" || true
fi
cp -p "$staged" "$live"
chmod 755 "$live"
echo "Replaced $live (backup at $BACKUP_DIR/$fname)"
fi
done
echo "Updates applied; backups in: $BACKUP_DIR"
else
echo
echo "Preview only. To apply staged updates run:"
echo " (cd \"$AI_BRAIN_DIR\" && ./update_starters.sh --apply)"
fi