diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d541e0..3bc4fa6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,3 +59,4 @@ jobs: npm --version cloc --version act --version + ollama --version diff --git a/README.md b/README.md index c1a8854..e3a1368 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ The following tools are installed (or skipped if already present): | [Node.js + npm](https://nodejs.org) | `brew install node` | | [`cloc`](https://github.com/AlDanial/cloc) | `brew install cloc` | | [`act`](https://github.com/nektos/act) | `brew install act` | +| [Ollama](https://ollama.com) | `curl -fsSL https://ollama.com/install.sh | sh` | The script is **idempotent** — re-running it is safe and will skip anything already installed. diff --git a/install.sh b/install.sh index 9a1cdf1..cc47e2c 100755 --- a/install.sh +++ b/install.sh @@ -117,6 +117,14 @@ else echo "🎬 act is already running scenes on the Severed Floor." fi +# 14. Ollama — local models for the Severed Floor +if ! command -v ollama &>/dev/null; then + echo "🦙 Ollama not found. The work needs a local model stack. Installing..." + brew install ollama +else + echo "🦙 Ollama is already running on the Severed Floor." +fi + echo "" echo "✅ Macrodata Refinement environment initialised." echo " The work is mysterious and important. Praise Kier. 🫱" diff --git a/test/install.bats b/test/install.bats index 85418e6..27cc0be 100644 --- a/test/install.bats +++ b/test/install.bats @@ -36,6 +36,13 @@ EOF exit 0 EOF chmod +x "$MOCK_BIN/curl" + + # sh mock: Ollama's install script pipes curl output into sh. + cat > "$MOCK_BIN/sh" <<'EOF' +#!/bin/bash +exit 0 +EOF + chmod +x "$MOCK_BIN/sh" } teardown() { @@ -362,6 +369,28 @@ EOF [[ "$output" == *"act is already running scenes"* ]] } +# --------------------------------------------------------------------------- +# Ollama section +# --------------------------------------------------------------------------- + +@test "installs Ollama when ollama is not on PATH" { + run env PATH="$MOCK_BIN" /bin/bash "$SCRIPT" + [ "$status" -eq 0 ] + [[ "$output" == *"Ollama not found"* ]] +} + +@test "skips Ollama when ollama is already installed" { + cat > "$MOCK_BIN/ollama" <<'EOF' +#!/bin/bash +exit 0 +EOF + chmod +x "$MOCK_BIN/ollama" + + run bash "$SCRIPT" + [ "$status" -eq 0 ] + [[ "$output" == *"Ollama is already running"* ]] +} + # --------------------------------------------------------------------------- # End-to-end: all tools already present # --------------------------------------------------------------------------- @@ -374,7 +403,7 @@ EOF @test "exits successfully when all tools are already installed" { # Stubs for every command-based tool - for tool in gcloud oc gh uvx python3 gws node cloc act; do + for tool in gcloud oc gh uvx python3 gws node cloc act ollama; do cat > "$MOCK_BIN/$tool" <<'EOF' #!/bin/bash exit 0 @@ -404,4 +433,5 @@ EOF [[ "$output" == *"Defiant Jazz"* ]] [[ "$output" == *"cloc is already tallying lines"* ]] [[ "$output" == *"act is already running scenes"* ]] + [[ "$output" == *"Ollama is already running"* ]] }