Files
zeekay 1b367e2b62 chore: rebase the tree onto upstream master
The tree was a debranded snapshot of upstream taken around 2026-02-20, and
upstream has moved about five months since. This replaces it with upstream
master, mechanically re-derived: bin/debrand does the rename, and the
pipeline and squashed migrations are restored from the shipped tree.

Not a merge. The previous import replaced the tree wholesale in a single
commit, so there is no shared content history to merge against. Reproducing
the rename on the new tree is what actually converges.

What survives: .hanzo/workflows, the Dockerfiles and bin/docker* entrypoints,
compose files, LLM.md, and insights/migrations. The squashed initial
migration is load-bearing — the live database records it by name, so
upstream's ~918 individual migrations cannot come back.

Nine products are dropped as unreferenced. Twenty-one more that we do not run
are kept anyway because the core app still imports them; unpicking those is a
refactor and does not belong in a rebase.

This base does not build yet, and the reasons are not in the rename:
upstream now wants Python 3.13.13 against our 3.12.12 and Django 5.2 against
our 4.2, and the dependency manifests still name upstream packages that we
republish under our own names. Those are decisions, not renames.
2026-08-01 15:44:40 -07:00

100 lines
2.8 KiB
Bash
Executable File

#!/bin/bash
# phrocs installer
#
# Usage:
# curl -fsSL https://raw.githubusercontent.com/Insights/insights/master/tools/phrocs/install.sh | sh
set -euo pipefail
REPO="Insights/insights"
RELEASE_TAG="phrocs-latest"
main() {
OS="$(uname -s)"
ARCH="$(uname -m)"
case "$OS" in
Linux) os="linux" ;;
Darwin) os="darwin" ;;
*)
echo "Error: unsupported OS: $OS" >&2
exit 1
;;
esac
case "$ARCH" in
x86_64|amd64) arch="amd64" ;;
arm64|aarch64) arch="arm64" ;;
*)
echo "Error: unsupported architecture: $ARCH" >&2
exit 1
;;
esac
BINARY="phrocs-${os}-${arch}"
URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/${BINARY}"
# Determine install directory
if [ -w /usr/local/bin ]; then
INSTALL_DIR="/usr/local/bin"
elif [ -d "$HOME/.local/bin" ]; then
INSTALL_DIR="$HOME/.local/bin"
else
mkdir -p "$HOME/.local/bin"
INSTALL_DIR="$HOME/.local/bin"
fi
CHECKSUMS_URL="https://github.com/${REPO}/releases/download/${RELEASE_TAG}/checksums.txt"
TMPDIR="$(mktemp -d)"
trap 'rm -rf "$TMPDIR"' EXIT
echo "Downloading phrocs for ${os}/${arch}..."
if command -v curl >/dev/null 2>&1; then
curl -fsSL "$URL" -o "${TMPDIR}/phrocs"
curl -fsSL "$CHECKSUMS_URL" -o "${TMPDIR}/checksums.txt"
elif command -v wget >/dev/null 2>&1; then
wget -qO "${TMPDIR}/phrocs" "$URL"
wget -qO "${TMPDIR}/checksums.txt" "$CHECKSUMS_URL"
else
echo "Error: curl or wget is required" >&2
exit 1
fi
# Verify checksum
EXPECTED=$(grep -F " ${BINARY}" "${TMPDIR}/checksums.txt" | awk '{print $1}' || true)
if [ -z "$EXPECTED" ]; then
echo "Error: no checksum found for ${BINARY}" >&2
exit 1
fi
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL=$(sha256sum "${TMPDIR}/phrocs" | awk '{print $1}')
elif command -v shasum >/dev/null 2>&1; then
ACTUAL=$(shasum -a 256 "${TMPDIR}/phrocs" | awk '{print $1}')
else
echo "Warning: cannot verify checksum (sha256sum/shasum not found), skipping" >&2
ACTUAL="$EXPECTED"
fi
if [ "$ACTUAL" != "$EXPECTED" ]; then
echo "Error: checksum mismatch (expected ${EXPECTED}, got ${ACTUAL})" >&2
exit 1
fi
cp "${TMPDIR}/phrocs" "${INSTALL_DIR}/phrocs"
chmod +x "${INSTALL_DIR}/phrocs"
echo "Installed phrocs to ${INSTALL_DIR}/phrocs"
"${INSTALL_DIR}/phrocs" --version
# Warn if install dir is not in PATH
case ":$PATH:" in
*":${INSTALL_DIR}:"*) ;;
*)
echo ""
echo "Note: ${INSTALL_DIR} is not in your PATH."
echo "Add it with: export PATH=\"${INSTALL_DIR}:\$PATH\""
;;
esac
}
main