···11-#!/usr/bin/env bun
22-31import { existsSync } from "node:fs";
42import { Command } from "commander";
53import packageJson from "./package.json" with { type: "json" };
···11-#!/usr/bin/env bash
22-# Install the cxs CLI from a GitHub Release binary.
33-#
44-# Usage:
55-# curl -fsSL https://raw.githubusercontent.com/catoncat/cxs/main/scripts/install.sh | bash
66-#
77-# Override the destination with CXS_INSTALL_DIR (default: ~/.local/bin).
88-99-set -euo pipefail
1010-1111-OWNER="catoncat"
1212-REPO="cxs"
1313-INSTALL_DIR="${CXS_INSTALL_DIR:-$HOME/.local/bin}"
1414-1515-OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
1616-ARCH_RAW="$(uname -m)"
1717-1818-case "$ARCH_RAW" in
1919- arm64|aarch64) ARCH="arm64" ;;
2020- x86_64|amd64) ARCH="x64" ;;
2121- *) echo "unsupported arch: $ARCH_RAW" >&2; exit 1 ;;
2222-esac
2323-2424-case "$OS" in
2525- darwin) PLATFORM="darwin-$ARCH" ;;
2626- linux) PLATFORM="linux-$ARCH" ;;
2727- *)
2828- echo "unsupported OS: $OS" >&2
2929- echo "cxs supports macOS and Linux only. Windows users: please run under WSL." >&2
3030- exit 1
3131- ;;
3232-esac
3333-3434-ASSET="cxs-${PLATFORM}"
3535-URL="https://github.com/${OWNER}/${REPO}/releases/latest/download/${ASSET}"
3636-3737-mkdir -p "$INSTALL_DIR"
3838-TARGET="$INSTALL_DIR/cxs"
3939-4040-echo "downloading $ASSET from $URL"
4141-curl -fsSL --proto '=https' --tlsv1.2 -o "$TARGET" "$URL"
4242-chmod +x "$TARGET"
4343-4444-echo
4545-echo "installed: $TARGET"
4646-echo
4747-"$TARGET" --version || {
4848- echo "warning: just-installed binary failed to run; remove $TARGET and retry" >&2
4949- exit 1
5050-}
5151-5252-case ":$PATH:" in
5353- *":$INSTALL_DIR:"*)
5454- echo
5555- echo "ready: cxs --help"
5656- ;;
5757- *)
5858- echo
5959- echo "tip: $INSTALL_DIR is not in PATH yet; add to your shell rc:"
6060- echo " export PATH=\"$INSTALL_DIR:\$PATH\""
6161- ;;
6262-esac
+1-1
scripts/post-build.mjs
···1313const SHEBANG = "#!/usr/bin/env node\n";
1414const original = readFileSync(distCli, "utf8");
15151616-// Source file may carry its own shebang (e.g. #!/usr/bin/env bun for dev).
1616+// Source file may carry its own shebang in development.
1717// Always normalize to node for the published artifact.
1818const stripped = original.startsWith("#!") ? original.slice(original.indexOf("\n") + 1) : original;
1919writeFileSync(distCli, SHEBANG + stripped);