-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
123 lines (111 loc) · 4.18 KB
/
Copy pathupdate.sh
File metadata and controls
123 lines (111 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
# (Case-Wave + Braille-Wave) for a premium terminal experience.
python3 - << 'EOF'
import sys
import time
import math
import threading
import subprocess
import os
try:
from rich.console import Console
from rich.text import Text
from rich.live import Live
from rich.align import Align
from rich.rule import Rule
except ImportError:
# Fallback if rich is not installed
print("[*] Checking for updates...")
subprocess.run("git fetch --all && git reset --hard origin/main", shell=True)
sys.exit(0)
# ------ CONFIGURATION & ASSETS ------
_BRAILLE_WAVE = ["⠁", "⠃", "⠇", "⡇", "⣇", "⣧", "⣷", "⣿", "⣾", "⣶", "⣦", "⣄", "⡄", "⠄", "⠀", "⠀"]
console = Console()
def case_wave(text: str, frame: float) -> Text:
result = Text()
for i, ch in enumerate(text):
if ch == " ":
result.append(" ")
continue
val = math.sin(i * 0.45 + frame * 3.5)
if val > 0.6:
result.append(ch.upper(), style="bold cyan")
elif val > 0.2:
result.append(ch.upper(), style="cyan")
elif val > -0.2:
result.append(ch, style="white")
elif val > -0.6:
result.append(ch.lower(), style="dim cyan")
else:
result.append(ch.lower(), style="dim")
return result
def draw_ui(text, stop_event):
n = len(_BRAILLE_WAVE)
width = 26
with Live("", refresh_per_second=15, transient=True) as live:
while not stop_event.is_set():
t = time.time()
txt = case_wave(text, t)
chars = ""
for i in range(width):
idx = int((i * 2 - t * 12)) % n
if idx < 0: idx += n
chars += _BRAILLE_WAVE[idx]
content = Text.assemble(txt, " ", (chars, "bold cyan"))
live.update(Align.center(content))
time.sleep(0.05)
def run_task(text, cmd):
stop_event = threading.Event()
t = threading.Thread(target=draw_ui, args=(text, stop_event), daemon=True)
t.start()
try:
res = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return res
finally:
stop_event.set()
t.join(timeout=1)
def print_banner():
art = r"""
_ _ _____ ___ ___
/ \ __ _ ___ _ __ | |_|___ / ( _ )/ _ \
/ _ \ / _` |/ _ \ '_ \| __| |_ \ / _ \ (_) |
/ ___ \ (_| | __/ | | | |_ ___) | (_) \__, |
/_/ \_\__, |\___|_| |_|\__|____/ \___/ /_/
|___/
"""
console.print("\n")
console.print(Align.center(Text(art, style="bold white")))
console.print(Align.center(Text("— S Y S T E M U P D A T E E N G I N E —", style="dim")))
console.print(Rule(style="dim cyan"))
console.print("\n")
def main():
print_banner()
# Phase 1: Git Sync
res = run_task("CHECKING FOR UPDATES", "git fetch --all && git reset --hard origin/main")
if res.returncode == 0:
console.print(Align.center(Text("[+] SUCCESS: SYNCED WITH REMOTE CLOUD", style="bold green")))
else:
console.print(Align.center(Text("[-] ERROR: FAILED TO SYNC WITH REMOTE", style="bold red")))
sys.exit(1)
# Phase 2: Dependency Update
if os.path.exists(".venv"):
res = run_task("UPDATING DEPENDENCIES", "./.venv/bin/pip install --upgrade pip && ./.venv/bin/pip install -e .")
if res.returncode == 0:
console.print(Align.center(Text("[+] SUCCESS: VIRTUAL ENVIRONMENT OPTIMIZED", style="bold green")))
else:
console.print(Align.center(Text("[-] ERROR: DEPENDENCY INJECTION FAILED", style="bold red")))
sys.exit(1)
else:
console.print(Align.center(Text("[!] WARNING: .VENV NOT FOUND - SKIPPING PIP", style="bold yellow")))
console.print("\n")
console.print(Rule(style="dim cyan"))
console.print(Align.center(Text("AGENT389 HAS BEEN RE-ARMED", style="bold white")))
console.print(Align.center(Text("VERSION: 1.0.0-STABLE", style="dim")))
console.print("\n")
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
console.print("\n[bold red][!] UPDATE ABORTED BY USER[/bold red]")
sys.exit(1)
EOF