npm run cli -- <args> only works from inside this repo's directory, which is awkward everywhere but especially on a deploy host running this alongside a dozen other projects. scripts/install-cli.sh builds the CLI and symlinks dist/cli/index.js onto PATH (~/.local/bin by default, no root/global npm install needed) as a real `keep` command, runnable from anywhere. Symlinked rather than copied, so a future `git pull && npm run build` is the entire upgrade story -- no need to re-run the install script after the first time. Verified: keep --help and keep identity show both work correctly from unrelated directories (/tmp, $HOME) after running the install script, confirming no hidden cwd dependency. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
24 lines
840 B
Bash
Executable File
24 lines
840 B
Bash
Executable File
#!/bin/sh
|
|
# Builds keep and symlinks the CLI onto PATH as a real `keep` command --
|
|
# no `npm run cli --` from inside this repo, no npm global install (which
|
|
# needs root/write access to the system Node install on most hosts).
|
|
#
|
|
# Since this is a symlink to dist/cli/index.js rather than a copy, a
|
|
# future `git pull && npm run build` here is the entire upgrade story --
|
|
# no need to re-run this script.
|
|
set -eu
|
|
cd "$(dirname "$0")/.."
|
|
|
|
BIN_DIR="${KEEP_BIN_DIR:-$HOME/.local/bin}"
|
|
mkdir -p "$BIN_DIR"
|
|
|
|
npm run build
|
|
chmod +x dist/cli/index.js
|
|
ln -sf "$(pwd)/dist/cli/index.js" "$BIN_DIR/keep"
|
|
|
|
echo "keep CLI linked: $BIN_DIR/keep -> $(pwd)/dist/cli/index.js"
|
|
case ":$PATH:" in
|
|
*":$BIN_DIR:"*) echo "$BIN_DIR is already on PATH — try: keep --help" ;;
|
|
*) echo "warning: $BIN_DIR is not on PATH — add it to your shell profile" ;;
|
|
esac
|