generated from google-gemini/aistudio-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_.bashrc
More file actions
executable file
·151 lines (129 loc) · 4.85 KB
/
_.bashrc
File metadata and controls
executable file
·151 lines (129 loc) · 4.85 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# ~/.bashrc: Optimized for Nexus-AI Workflow
# Integrates WSL1 Debian + Ollama + 2Pi/8-Agents
# =============================================================================
# 1. ENVIRONMENT & KEYS
# =============================================================================
export GEMINI_API_KEY="AIzaSyAjRGROgF9dCuSZ8StFS8PMfOd0f3l-iec"
export GEMINI_PROJECT_ID="gen-lang-client-0866252427"
export OLLAMA_HOST="http://localhost:11434"
export OLLAMA_KEEP_ALIVE="10m"
export OLLAMA_MAX_LOADED_MODELS="1"
# NEXUS Paths
export NEXUS_ROOT="/home/loop/_"
export AI_DIR="$NEXUS_ROOT/ai"
export PATH="$PATH:$AI_DIR:$HOME/ollama"
eval $(ssh-agent -s)
# =============================================================================
# 2. INTERACTIVE CHECK & HISTORY
# =============================================================================
case $- in
*i*) ;;
*) return ;;
esac
HISTCONTROL=ignoreboth
shopt -s histappend
HISTSIZE=5000
HISTFILESIZE=10000
shopt -s checkwinsize
# =============================================================================
# 3. PROMPT & COLORS
# =============================================================================
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+(debian_chroot)}[\033[01;32m]\u@\h[\033[00m]:[\033[01;34m]\w[\033[00m]\$ '
else
PS1='${debian_chroot:+(debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
fi
# =============================================================================
# 4. EXTERNAL TOOLS (Brew, NVM, SSH)
# =============================================================================
# Linuxbrew
if [ -d "/home/linuxbrew/.linuxbrew" ]; then
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
fi
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# SSH Agent
if [ -f "$HOME/.ssh/auto-ssh-agent.sh" ]; then
source "$HOME/.ssh/auto-ssh-agent.sh"
elif [ -x "$(command -v ssh-agent)" ]; then
eval $(ssh-agent -s) > /dev/null
fi
# =============================================================================
# 5. OLLAMA & AGENT DAEMONS
# =============================================================================
ollama_check() { curl -sf "$OLLAMA_HOST/api/tags" >/dev/null; }
start_ollama() {
if ! ollama_check; then
echo "[System] Starting Ollama (Slim)..."
mkdir -p "$HOME/.gemini/tmp"
nohup ollama serve > "$HOME/.gemini/tmp/ollama.log" 2>&1 &
sleep 1
fi
}
start_ollama
monitor_agents() {
nohup bash -c "
while true; do
for agent in CUBE CORE LOOP LINE WAVE COIN CODE WORK; do
pidfile=\"$AI_DIR/logs/\$agent.pid\"
if [ -f "\$pidfile" ] && ! ps -p \"\\\$(cat \"\$pidfile\")\" >/dev/null 2>&1; then
echo \"[WARN] Agent \$agent down\"
fi
done
sleep 60
done
" &>/dev/null &
}
monitor_agents
# =============================================================================
# 6. NEXUS-AI ALIASES & HELPERS
# =============================================================================
alias ai="$AI_DIR/ai.sh"
alias zen="$AI_DIR/ai.sh"
alias nx-sys="$NEXUS_ROOT/nexus-system.sh"
alias nx-shell="python3 $NEXUS_ROOT/nexus-shell.py"
alias nx-pdf="python3 $NEXUS_ROOT/nexus-pdf-generate.py"
alias nx-init="$NEXUS_ROOT/gemini-cli.installer.sh"
alias nx-logs="tail -f $HOME/.gemini/tmp/ollama.log"
alias nx-db="sqlite3 $NEXUS_ROOT/memory.db"
alias nx-scan="ai reason \"scan all recursive folders of this repository for having a complete system-scan check\""
alias nx-git-fix="git reflog expire --expire=now --all && git gc --prune=now && git fsck"
ai_status() {
echo "=== NEXUS-AI Status ==="
echo "Ollama: $(ollama_check && echo 'Active' || echo 'Inactive')"
echo "Agents: $(ls $AI_DIR/logs/*.pid 2>/dev/null | wc -l) active"
echo "Root: $NEXUS_ROOT"
}
# Auto-complete
if [ -f "$AI_DIR/ai.sh" ]; then
complete -W "reason refactor batch scan analyze files recall stats cleanup export agents models help" ai
fi
# =============================================================================
# 7. FINALIZATION
# =============================================================================
if [ -f "$HOME/.env.local/bin/activate" ]; then
source "$HOME/.env.local/bin/activate"
fi
pm2 resurrect
alias asi="ollama run glm-4.7:cloud"
docker run nexus/base
sudo /etc/init.d/apache2 restart