Skip to content

Commit b05aeed

Browse files
committed
feat: robust install script with shellbrain init
1 parent bd6cc26 commit b05aeed

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎docs/index.html‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@
519519

520520
<div class="install-line" onclick="copyInstall()" title="Click to copy">
521521
<span class="install-prompt">$</span>
522-
<span class="install-cmd" id="installCmd">curl -L shellbrain.ai/install | bash</span>
522+
<span class="install-cmd" id="installCmd">curl -L shellbrain.ai/install | bash && shellbrain init</span>
523523
</div>
524524
<div class="install-copied" id="installHint"></div>
525525
</div>
@@ -677,7 +677,7 @@ <h2 class="section-title">your brain. your machine. your knowledge.</h2>
677677
<script>
678678
// ── Install copy ─────────────────────────────
679679
function copyInstall() {
680-
navigator.clipboard.writeText("curl -L shellbrain.ai/install | bash").then(() => {
680+
navigator.clipboard.writeText("curl -L shellbrain.ai/install | bash && shellbrain init").then(() => {
681681
const hint = document.getElementById("installHint");
682682
hint.textContent = "copied";
683683
setTimeout(() => { hint.textContent = "click to copy"; }, 1600);

‎docs/install‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
#!/bin/bash
2-
pip install shellbrain
1+
#!/usr/bin/env bash
2+
set -eo pipefail
3+
4+
echo "installing shellbrain..."
5+
6+
# Find python
7+
if command -v python3 &>/dev/null; then
8+
PY=python3
9+
elif command -v python &>/dev/null; then
10+
PY=python
11+
else
12+
echo "error: python not found. install python3 first."
13+
exit 1
14+
fi
15+
16+
# Install with fallback chain
17+
$PY -m pip install --user --break-system-packages shellbrain 2>/dev/null \
18+
|| $PY -m pip install --user shellbrain 2>/dev/null \
19+
|| $PY -m pip install shellbrain
20+
21+
echo ""
22+
echo "installed. initializing..."
23+
24+
# Source profile so shellbrain is on PATH
25+
case $SHELL in
26+
*/zsh) [ -f "$HOME/.zprofile" ] && . "$HOME/.zprofile" 2>/dev/null; [ -f "$HOME/.zshrc" ] && . "$HOME/.zshrc" 2>/dev/null ;;
27+
*/bash) [ -f "$HOME/.bashrc" ] && . "$HOME/.bashrc" 2>/dev/null; [ -f "$HOME/.bash_profile" ] && . "$HOME/.bash_profile" 2>/dev/null ;;
28+
esac
29+
30+
shellbrain init

0 commit comments

Comments
 (0)