From c59ee33efecb41cd3b04063c2165b03a29b04bc7 Mon Sep 17 00:00:00 2001 From: yetone Date: Thu, 15 Oct 2026 18:13:30 +0800 Subject: [PATCH] scripts/owner.sh: npm asks for 2FA on the terminal, and a run with none stops first Run through Claude Code's ! (no terminal), every npm step printed the 2FA link and failed with EOTP at once: npm waits for the browser only when it can ask on a terminal. npm now reads from /dev/tty, so piping the script to sh still works, and a run with no terminal says so before any npm step. Run: with no terminal, --dry-run lists the four packages and the real run stops with the message, exit 1, nothing asked of npm. Not run on a terminal (that takes the owner's 2FA). --- scripts/owner.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/owner.sh b/scripts/owner.sh index f5a999d..944aaf1 100755 --- a/scripts/owner.sh +++ b/scripts/owner.sh @@ -21,8 +21,10 @@ dry="" repo=magpie-community/plugins reg=https://registry.npmjs.org/ export npm_config_registry="$reg" -# npm trust needs npm 11.5 or later -npm11() { npx -y npm@11 "$@"; } +# npm trust needs npm 11.5 or later. Its 2FA waits for the browser only +# when it can ask on a terminal; without one it prints the link and fails +# with EOTP, so npm reads from the terminal even when this script is piped. +npm11() { npx -y npm@11 "$@" /dev/null; then + echo "npm's 2FA needs a terminal: run this in Terminal (not through a tool with no terminal, such as Claude Code's !)." >&2 + exit 1 +fi if ! npm11 whoami >/dev/null 2>&1; then echo "Signing in to npm (in the browser)..."