Skill Tracer
Skills › gstack › gstack › setup-scc.sh

setup-scc.sh

71 lines · scripts/setup-scc.sh at 3f79d81

1#!/usr/bin/env bash
2# setup-scc.sh — install scc (github.com/boyter/scc), used by
3# scripts/garry-output-comparison.ts for logical-line classification of added lines.
4#
5# Why standalone (not a package.json dependency): 95% of gstack users never run
6# the throughput script. Making scc a required install step for every `bun install`
7# would bloat onboarding for no reason. This script is invoked only when you
8# actually want to run garry-output-comparison.ts.
9#
10# Usage: bash scripts/setup-scc.sh
11set -euo pipefail
13if command -v scc >/dev/null 2>&1; then
14 echo "scc is already installed: $(command -v scc)"
15 echo "Version: $(scc --version 2>/dev/null || echo 'unknown')"
16 exit 0
17fi
19OS="$(uname -s)"
20case "$OS" in
21 Darwin)
22 if command -v brew >/dev/null 2>&1; then
23 echo "Installing scc via Homebrew..."
24 brew install scc
25 else
26 echo "Homebrew not found. Install from https://brew.sh or download scc manually:"
27 echo " https://github.com/boyter/scc/releases"
28 exit 1
29 fi
30 ;;
31 Linux)
32 if command -v apt-get >/dev/null 2>&1; then
33 echo "Attempting apt-get install scc..."
34 if sudo apt-get install -y scc 2>/dev/null; then
35 echo "Installed via apt."
36 else
37 echo "scc not in apt repos. Download the Linux binary manually:"
38 echo " https://github.com/boyter/scc/releases"
39 echo " After download: chmod +x scc && sudo mv scc /usr/local/bin/"
40 exit 1
41 fi
42 elif command -v pacman >/dev/null 2>&1; then
43 echo "Installing scc via pacman..."
44 sudo pacman -S --noconfirm scc
45 else
46 echo "Unknown Linux package manager. Download the binary manually:"
47 echo " https://github.com/boyter/scc/releases"
48 exit 1
49 fi
50 ;;
51 MINGW*|MSYS*|CYGWIN*)
52 echo "Windows detected. Download the scc Windows binary from:"
53 echo " https://github.com/boyter/scc/releases"
54 echo "Add it to your PATH."
55 exit 1
56 ;;
57 *)
58 echo "Unknown OS: $OS. Download scc manually:"
59 echo " https://github.com/boyter/scc/releases"
60 exit 1
61 ;;
62esac
64# Verify install
65if command -v scc >/dev/null 2>&1; then
66 echo "scc installed: $(command -v scc)"
67 scc --version
68else
69 echo "Install appears to have failed. scc not found in PATH after install."
70 exit 1
71fi