@visa/cli 2.0.0-rc.63 → 2.0.0-rc.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -6
- package/dist/cli.js +107 -103
- package/dist/mcp-server/index.js +19 -19
- package/install.sh +120 -0
- package/package.json +2 -1
package/install.sh
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Visa CLI installer for macOS and Linux
|
|
3
|
+
# Usage: bash <(curl -fsSL https://visacli.sh/install.sh)
|
|
4
|
+
#
|
|
5
|
+
# The entire body is wrapped in _visa_install() so bash must parse the full
|
|
6
|
+
# file before executing anything — prevents partial-download execution if
|
|
7
|
+
# the TCP connection drops mid-transfer (standard curl-pipe-bash hardening;
|
|
8
|
+
# rustup, brew, and nvm all do the same).
|
|
9
|
+
|
|
10
|
+
_visa_install() {
|
|
11
|
+
set -euo pipefail
|
|
12
|
+
|
|
13
|
+
REQUIRED_NODE_MAJOR=18
|
|
14
|
+
PACKAGE="@visa/cli"
|
|
15
|
+
|
|
16
|
+
# ── colours (disabled when piped) ─────────────────────────────────────────────
|
|
17
|
+
if [ -t 1 ]; then
|
|
18
|
+
GREEN='\033[0;32m' RED='\033[0;31m' YELLOW='\033[0;33m'
|
|
19
|
+
CYAN='\033[0;36m' DIM='\033[2m' RESET='\033[0m'
|
|
20
|
+
else
|
|
21
|
+
GREEN='' RED='' YELLOW='' CYAN='' DIM='' RESET=''
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
info() { printf " ${CYAN}%s${RESET}\n" "$*"; }
|
|
25
|
+
ok() { printf " ${GREEN}[OK]${RESET} %s\n" "$*"; }
|
|
26
|
+
warn() { printf " ${YELLOW}%s${RESET}\n" "$*"; }
|
|
27
|
+
fail() { printf " ${RED}%s${RESET}\n" "$*"; exit 1; }
|
|
28
|
+
|
|
29
|
+
# ── banner ────────────────────────────────────────────────────────────────────
|
|
30
|
+
echo ""
|
|
31
|
+
info "Visa CLI Installer"
|
|
32
|
+
echo ""
|
|
33
|
+
|
|
34
|
+
# ── detect OS ─────────────────────────────────────────────────────────────────
|
|
35
|
+
OS="$(uname -s)"
|
|
36
|
+
case "$OS" in
|
|
37
|
+
Darwin) ;; Linux) ;;
|
|
38
|
+
*) fail "Unsupported OS: $OS. Use the PowerShell installer on Windows." ;;
|
|
39
|
+
esac
|
|
40
|
+
|
|
41
|
+
# ── check Node.js ─────────────────────────────────────────────────────────────
|
|
42
|
+
if ! command -v node &>/dev/null; then
|
|
43
|
+
fail "Node.js is required but not installed.
|
|
44
|
+
Install from https://nodejs.org/ or use nvm:
|
|
45
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
|
|
46
|
+
nvm install ${REQUIRED_NODE_MAJOR}"
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
NODE_VERSION="$(node --version)"
|
|
50
|
+
NODE_MAJOR="${NODE_VERSION#v}"
|
|
51
|
+
NODE_MAJOR="${NODE_MAJOR%%.*}"
|
|
52
|
+
|
|
53
|
+
case "$NODE_MAJOR" in
|
|
54
|
+
''|*[!0-9]*) fail "Unexpected node --version output: ${NODE_VERSION}" ;;
|
|
55
|
+
esac
|
|
56
|
+
|
|
57
|
+
if [ "$NODE_MAJOR" -lt "$REQUIRED_NODE_MAJOR" ]; then
|
|
58
|
+
fail "Node.js ${NODE_VERSION} is too old. Version ${REQUIRED_NODE_MAJOR}+ required.
|
|
59
|
+
Install from https://nodejs.org/ or: nvm install ${REQUIRED_NODE_MAJOR}"
|
|
60
|
+
fi
|
|
61
|
+
|
|
62
|
+
ok "Node.js ${NODE_VERSION}"
|
|
63
|
+
|
|
64
|
+
# ── check npm ─────────────────────────────────────────────────────────────────
|
|
65
|
+
if ! command -v npm &>/dev/null; then
|
|
66
|
+
fail "npm is required but not found.
|
|
67
|
+
Reinstall Node.js from https://nodejs.org/ and try again."
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
ok "npm $(npm --version)"
|
|
71
|
+
|
|
72
|
+
# ── install ───────────────────────────────────────────────────────────────────
|
|
73
|
+
printf " ${DIM}Running: npm install -g ${PACKAGE}${RESET}\n"
|
|
74
|
+
|
|
75
|
+
NPM_OUTPUT=""
|
|
76
|
+
NPM_EXIT=0
|
|
77
|
+
NPM_OUTPUT="$(npm install -g "$PACKAGE" 2>&1)" || NPM_EXIT=$?
|
|
78
|
+
|
|
79
|
+
if [ "$NPM_EXIT" -ne 0 ]; then
|
|
80
|
+
echo "$NPM_OUTPUT"
|
|
81
|
+
echo ""
|
|
82
|
+
|
|
83
|
+
if echo "$NPM_OUTPUT" | grep -qiE 'EACCES|permission denied|access denied'; then
|
|
84
|
+
warn "Permission problem. Fix with a user-scoped npm prefix:"
|
|
85
|
+
warn " mkdir -p ~/.npm-global"
|
|
86
|
+
warn " npm config set prefix ~/.npm-global"
|
|
87
|
+
warn ' export PATH="$HOME/.npm-global/bin:$PATH"'
|
|
88
|
+
warn "Add the export line to your shell profile, then rerun this installer."
|
|
89
|
+
elif echo "$NPM_OUTPUT" | grep -qiE 'UNABLE_TO_GET_ISSUER_CERT|SELF_SIGNED_CERT|CERT_HAS_EXPIRED'; then
|
|
90
|
+
warn "Certificate/proxy problem. If you are on a corporate network,"
|
|
91
|
+
warn "use a personal network or ask IT for the npm certificate configuration."
|
|
92
|
+
else
|
|
93
|
+
warn "npm install failed (exit $NPM_EXIT). Run manually for details:"
|
|
94
|
+
warn " npm install -g ${PACKAGE}"
|
|
95
|
+
fi
|
|
96
|
+
exit 1
|
|
97
|
+
fi
|
|
98
|
+
|
|
99
|
+
echo "$NPM_OUTPUT"
|
|
100
|
+
|
|
101
|
+
# ── verify ────────────────────────────────────────────────────────────────────
|
|
102
|
+
VISA_VERSION=""
|
|
103
|
+
if command -v visa-cli &>/dev/null; then
|
|
104
|
+
VISA_VERSION="$(visa-cli --version 2>/dev/null || true)"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
echo ""
|
|
108
|
+
if [ -n "$VISA_VERSION" ]; then
|
|
109
|
+
ok "Visa CLI ${VISA_VERSION} installed."
|
|
110
|
+
info "Run 'visa-cli setup' to get started."
|
|
111
|
+
info "After setup, run /mcp inside Claude Code, not Terminal, if Claude Code was already open."
|
|
112
|
+
else
|
|
113
|
+
warn "Installed, but 'visa-cli' was not found on PATH."
|
|
114
|
+
warn "You may need to restart your shell, then run: visa-cli setup"
|
|
115
|
+
fi
|
|
116
|
+
echo ""
|
|
117
|
+
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
_visa_install "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visa/cli",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.64",
|
|
4
4
|
"description": "AI-powered payments for Claude Code",
|
|
5
5
|
"bin": {
|
|
6
6
|
"visa-cli": "./bin/visa-cli.js"
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"bin/visa-cli.js",
|
|
71
71
|
"dist/",
|
|
72
72
|
"install.ps1",
|
|
73
|
+
"install.sh",
|
|
73
74
|
"native/visa-keychain.m",
|
|
74
75
|
"server.json",
|
|
75
76
|
"README.md",
|