Skip to content

Commit 2127d79

Browse files
RichmondAlakeclaude
andcommitted
feat(install): add curl|sh one-liner installer for the memorizz CLI
curl -fsSL https://raw.githubusercontent.com/RichmondAlake/memorizz/main/install.sh | sh Bootstraps uv (standalone, no Python required), then `uv tool install`s the CLI; falls back to pipx then pip --user. Pins `--python 3.12` because uv otherwise defaults to whatever interpreter it finds first — and an interpreter <3.10 makes it silently resolve a stale memorizz (0.1.0 requires >=3.10). Verified end-to-end: installs 0.1.0 and `memorizz --version` works. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a3de661 commit 2127d79

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

install.sh

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/usr/bin/env sh
2+
# memorizz CLI installer.
3+
#
4+
# curl -fsSL https://raw.githubusercontent.com/RichmondAlake/memorizz/main/install.sh | sh
5+
#
6+
# Installs the `memorizz` interactive CLI via uv (a standalone binary that
7+
# manages its own Python — no pre-existing Python required). Falls back to pipx,
8+
# then pip --user. Safe to re-run; upgrades in place.
9+
10+
set -u
11+
12+
INFO() { printf '\033[36m[memorizz]\033[0m %s\n' "$1"; }
13+
WARN() { printf '\033[33m[memorizz]\033[0m %s\n' "$1" >&2; }
14+
ERR() { printf '\033[31m[memorizz]\033[0m %s\n' "$1" >&2; }
15+
16+
have() { command -v "$1" >/dev/null 2>&1; }
17+
18+
# Resolve a uv binary: already on PATH, in its default install dir, or freshly
19+
# installed via the official standalone installer.
20+
find_uv() {
21+
if have uv; then echo "uv"; return 0; fi
22+
for d in "$HOME/.local/bin" "$HOME/.cargo/bin" "$HOME/.local/share/uv/bin"; do
23+
if [ -x "$d/uv" ]; then echo "$d/uv"; return 0; fi
24+
done
25+
return 1
26+
}
27+
28+
UV="$(find_uv || true)"
29+
if [ -z "${UV:-}" ]; then
30+
INFO "Installing uv (standalone; no Python required)…"
31+
if have curl; then
32+
curl -LsSf https://astral.sh/uv/install.sh | sh
33+
elif have wget; then
34+
wget -qO- https://astral.sh/uv/install.sh | sh
35+
else
36+
ERR "Need curl or wget to install uv. Install one and re-run."
37+
exit 1
38+
fi
39+
UV="$(find_uv || true)"
40+
fi
41+
42+
if [ -n "${UV:-}" ]; then
43+
# Force a modern Python: memorizz needs >=3.10, and without this uv may fall
44+
# back to an older interpreter and silently resolve a stale memorizz release.
45+
INFO "Installing memorizz via uv (Python 3.12)…"
46+
if "$UV" tool install --force --python 3.12 memorizz; then
47+
"$UV" tool update-shell >/dev/null 2>&1 || true
48+
INFO "Installed. Start it with: memorizz"
49+
INFO "(If 'memorizz' isn't found, restart your shell or add ~/.local/bin to PATH.)"
50+
exit 0
51+
fi
52+
WARN "uv install failed — trying pipx, then pip."
53+
fi
54+
55+
if have pipx; then
56+
INFO "Installing memorizz via pipx…"
57+
if pipx install --force memorizz; then
58+
INFO "Installed (pipx). Start it with: memorizz"
59+
exit 0
60+
fi
61+
fi
62+
63+
if have python3; then
64+
INFO "Installing memorizz via pip --user…"
65+
if python3 -m pip install --user --upgrade memorizz; then
66+
INFO "Installed (pip --user). Start it with: memorizz"
67+
exit 0
68+
fi
69+
fi
70+
71+
ERR "Could not install memorizz automatically."
72+
ERR "Install uv from https://astral.sh/uv then run: uv tool install memorizz"
73+
exit 1

0 commit comments

Comments
 (0)