@visa/cli 2.0.0-rc.8 → 2.0.0

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/install.ps1 CHANGED
@@ -123,15 +123,44 @@ try {
123
123
  exit 1
124
124
  }
125
125
 
126
+ # Check npm separately. Some Windows installs expose node before a refreshed
127
+ # shell can find npm, and npm failures are much easier to fix when called out.
128
+ try {
129
+ $npmVersionOutput = (& npm --version 2>$null | Select-Object -First 1)
130
+ if ($LASTEXITCODE -ne 0 -or -not $npmVersionOutput) { throw "not found" }
131
+ Write-Host " [OK] npm $($npmVersionOutput.Trim())" -ForegroundColor Green
132
+ } catch {
133
+ Write-Host " npm is required but was not found." -ForegroundColor Red
134
+ Write-Host " Install Node.js from https://nodejs.org/, close and reopen PowerShell, then try again." -ForegroundColor Yellow
135
+ Wait-BeforeExit
136
+ exit 1
137
+ }
138
+
126
139
  # Install via npm
127
140
  Write-Host " Running: npm install -g @visa/cli" -ForegroundColor Gray
128
- & npm install -g @visa/cli 2>&1 | Out-Host
141
+ $npmOutput = & npm install -g @visa/cli 2>&1
142
+ $npmExitCode = $LASTEXITCODE
143
+ $npmText = ($npmOutput | Out-String)
144
+ $npmOutput | Out-Host
129
145
 
130
- if ($LASTEXITCODE -ne 0) {
146
+ if ($npmExitCode -ne 0) {
131
147
  Write-Host ""
132
- Write-Host " npm install failed (exit code $LASTEXITCODE)." -ForegroundColor Red
133
- Write-Host " Try running PowerShell as Administrator, or run manually:" -ForegroundColor Yellow
134
- Write-Host " npm install -g @visa/cli" -ForegroundColor Yellow
148
+ Write-Host " npm install failed (exit code $npmExitCode)." -ForegroundColor Red
149
+
150
+ if ($npmText -match 'Access is denied|EACCES|EPERM|permission denied') {
151
+ Write-Host " Permission problem detected. Prefer a user-scoped npm prefix before using Administrator PowerShell:" -ForegroundColor Yellow
152
+ Write-Host ' mkdir "$env:USERPROFILE\.npm-global"' -ForegroundColor Yellow
153
+ Write-Host ' npm config set prefix "$env:USERPROFILE\.npm-global"' -ForegroundColor Yellow
154
+ Write-Host ' [Environment]::SetEnvironmentVariable("Path", "$env:USERPROFILE\.npm-global;$env:Path", "User")' -ForegroundColor Yellow
155
+ Write-Host " Then close and reopen PowerShell and rerun this installer." -ForegroundColor Yellow
156
+ } elseif ($npmText -match 'UNABLE_TO_GET_ISSUER_CERT_LOCALLY|SELF_SIGNED_CERT_IN_CHAIN|CERT_HAS_EXPIRED|unable to verify') {
157
+ Write-Host " Certificate/proxy problem detected. If you are on a corporate network, use a personal network or ask IT for the npm certificate configuration." -ForegroundColor Yellow
158
+ Write-Host " Do not disable TLS verification globally." -ForegroundColor Yellow
159
+ } else {
160
+ Write-Host " Run manually for the full error, then retry:" -ForegroundColor Yellow
161
+ Write-Host " npm install -g @visa/cli" -ForegroundColor Yellow
162
+ }
163
+
135
164
  Wait-BeforeExit
136
165
  exit 1
137
166
  }
@@ -158,10 +187,12 @@ Write-Host ""
158
187
  if ($verifiedCommand) {
159
188
  Write-Host " Visa CLI $visaVersion installed." -ForegroundColor Green
160
189
  Write-Host " Run '$verifiedCommand setup' to get started." -ForegroundColor Cyan
190
+ Write-Host " After setup, run /mcp inside Claude Code, not PowerShell, if Claude Code was already open." -ForegroundColor Cyan
161
191
  Write-Host ""
162
192
  } else {
163
193
  $primaryCommand = $cliCommandNames | Select-Object -First 1
164
194
  Write-Host " Installed but '$primaryCommand' was not runnable from PATH yet." -ForegroundColor Yellow
165
195
  Write-Host " Close and reopen PowerShell, then run: $primaryCommand setup" -ForegroundColor Yellow
196
+ Write-Host " Run /mcp inside Claude Code after setup if you need to reconnect the MCP server." -ForegroundColor Yellow
166
197
  Write-Host ""
167
198
  }
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,11 +1,12 @@
1
1
  {
2
2
  "name": "@visa/cli",
3
- "version": "2.0.0-rc.8",
3
+ "version": "2.0.0",
4
4
  "description": "AI-powered payments for Claude Code",
5
5
  "bin": {
6
6
  "visa-cli": "./bin/visa-cli.js"
7
7
  },
8
8
  "scripts": {
9
+ "prebuild": "pnpm --filter @visa/money build && pnpm --filter @visa-cli/tools build",
9
10
  "build": "tsc --noEmit && node esbuild.config.js",
10
11
  "dev": "tsc --watch",
11
12
  "pretest": "pnpm build",
@@ -42,14 +43,15 @@
42
43
  "zod": "^3.23.0"
43
44
  },
44
45
  "devDependencies": {
46
+ "@visa/money": "workspace:*",
45
47
  "@visa/observability": "workspace:*",
46
48
  "@visa-cli/tools": "workspace:*",
47
49
  "@changesets/changelog-git": "^0.2.1",
48
50
  "@changesets/cli": "^2.31.0",
49
51
  "@types/jest": "^30.0.0",
50
- "@types/node": "^25.6.0",
51
- "@typescript-eslint/eslint-plugin": "^8.59.1",
52
- "@typescript-eslint/parser": "^8.59.1",
52
+ "@types/node": "^25.7.0",
53
+ "@typescript-eslint/eslint-plugin": "^8.59.3",
54
+ "@typescript-eslint/parser": "^8.59.3",
53
55
  "@types/express": "^5.0.0",
54
56
  "esbuild": "^0.27.4",
55
57
  "express": "^4.21.0",
@@ -68,6 +70,7 @@
68
70
  "bin/visa-cli.js",
69
71
  "dist/",
70
72
  "install.ps1",
73
+ "install.sh",
71
74
  "native/visa-keychain.m",
72
75
  "server.json",
73
76
  "README.md",