#!/usr/bin/env bash # InFlow CLI installer - served at https://inflowcli.ai/cli # Usage: curl -fsSL https://inflowcli.ai/cli | bash set -euo pipefail PACKAGE="@inflowpayai/inflow" MIN_NODE_MAJOR=22 say() { printf '\033[1m[inflow]\033[0m %s\n' "$*"; } fail() { printf '\033[1;31m[inflow]\033[0m %s\n' "$*" >&2; exit 1; } # 1. Check Node.js if ! command -v node >/dev/null 2>&1; then fail "Node.js >= ${MIN_NODE_MAJOR} is required but was not found. Install it from https://nodejs.org or via your package manager, then re-run: curl -fsSL https://inflowcli.ai/cli | bash" fi NODE_MAJOR="$(node -p 'process.versions.node.split(".")[0]')" if [ "${NODE_MAJOR}" -lt "${MIN_NODE_MAJOR}" ]; then fail "Node.js >= ${MIN_NODE_MAJOR} is required (found $(node -v)). Please upgrade and re-run." fi # 2. Install the binary say "Installing ${PACKAGE} globally via npm..." if npm install -g "${PACKAGE}"; then say "Installed $(inflow --version 2>/dev/null || echo "${PACKAGE}")." else fail "npm install failed. If this is a permissions issue, configure a user-level npm prefix: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally Or run without installing: npx -y ${PACKAGE}" fi # 3. Verify the binary is reachable if ! command -v inflow >/dev/null 2>&1; then NPM_BIN="$(npm prefix -g 2>/dev/null)/bin" say "Installed, but 'inflow' is not on your PATH yet." say " - Ensure ${NPM_BIN} is in your PATH" say " - Then refresh your shell's command cache:" say " bash: hash -r" say " zsh/tcsh: rehash" say " (or just open a new terminal)" fi # 4. Next steps say "Done. Get payment-ready in 2 steps:" say " 1. inflow auth login # OAuth device flow, then approve in your browser" say " 2. inflow auth status # confirm you're authenticated" say "" say "Using an AI agent? Just tell it:" say ' "Fetch inflowcli.ai/skill.md and get me set up with InFlow"' say "" say "Docs: https://inflowcli.ai/llms.txt - Source: https://github.com/inflowpayai/inflow-cli"