@visa/cli 2.1.0-rc.6 → 2.1.0-rc.7

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
@@ -168,16 +168,21 @@ if ($npmExitCode -ne 0) {
168
168
  # Verify
169
169
  $cliCommandNames = Get-InstalledCliCommands
170
170
  $verifiedCommand = $null
171
+ $verifiedCommandPath = $null
171
172
  $visaVersion = $null
172
173
 
173
174
  foreach ($commandName in $cliCommandNames) {
174
- if (-not (Get-Command $commandName -ErrorAction SilentlyContinue)) {
175
+ $commandInfo = Get-Command $commandName -ErrorAction SilentlyContinue
176
+ if (-not $commandInfo) {
175
177
  continue
176
178
  }
177
179
 
178
- $versionOutput = (& $commandName --version 2>$null | Select-Object -First 1)
180
+ # Capture the resolved executable path so the setup hand-off below runs
181
+ # exactly the binary verified here, not a fresh PATH lookup.
182
+ $versionOutput = (& $commandInfo.Source --version 2>$null | Select-Object -First 1)
179
183
  if ($LASTEXITCODE -eq 0 -and $versionOutput) {
180
184
  $verifiedCommand = $commandName
185
+ $verifiedCommandPath = $commandInfo.Source
181
186
  $visaVersion = $versionOutput.Trim()
182
187
  break
183
188
  }
@@ -186,8 +191,41 @@ foreach ($commandName in $cliCommandNames) {
186
191
  Write-Host ""
187
192
  if ($verifiedCommand) {
188
193
  Write-Host " Visa CLI $visaVersion installed." -ForegroundColor Green
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
194
+
195
+ # Hand off straight into setup so install -> setup -> signed-in is one
196
+ # uninterrupted flow. Hardening:
197
+ # * Auto-launch only on an interactive console with input/output/error
198
+ # all attached - setup must prompt and open a browser. Redirected
199
+ # streams and CI fall back to printing the next step.
200
+ # * Invoke $verifiedCommandPath (the path verified just above), not a
201
+ # bare command name re-resolved through PATH.
202
+ # * Pass only the literal "setup" argument - nothing caller-controlled.
203
+ if ($Host.Name -eq 'ConsoleHost' -and -not [Console]::IsInputRedirected -and -not [Console]::IsOutputRedirected -and -not [Console]::IsErrorRedirected -and -not $env:CI) {
204
+ Write-Host ""
205
+ Write-Host " Continuing to setup..." -ForegroundColor Cyan
206
+ Write-Host ""
207
+ try {
208
+ $setupProcess = Start-Process -FilePath $verifiedCommandPath -ArgumentList @('setup') -Wait -NoNewWindow -PassThru -ErrorAction Stop
209
+ } catch {
210
+ Write-Host ""
211
+ Write-Host " Setup could not start. Visa CLI is installed." -ForegroundColor Yellow
212
+ Write-Host " PowerShell error: $($_.Exception.Message)" -ForegroundColor Yellow
213
+ Write-Host " run '$verifiedCommand setup' when you're ready to finish." -ForegroundColor Yellow
214
+ Wait-BeforeExit
215
+ exit 1
216
+ }
217
+ if ($setupProcess.ExitCode -ne 0) {
218
+ Write-Host ""
219
+ Write-Host " Setup exited before completion. Visa CLI is installed." -ForegroundColor Yellow
220
+ Write-Host " run '$verifiedCommand setup' when you're ready to finish." -ForegroundColor Yellow
221
+ Wait-BeforeExit
222
+ exit 1
223
+ }
224
+ exit 0
225
+ } else {
226
+ Write-Host " Run '$verifiedCommand setup' to get started." -ForegroundColor Cyan
227
+ Write-Host " After setup, run /mcp inside Claude Code, not PowerShell, if Claude Code was already open." -ForegroundColor Cyan
228
+ }
191
229
  Write-Host ""
192
230
  } else {
193
231
  $primaryCommand = $cliCommandNames | Select-Object -First 1
package/install.sh CHANGED
@@ -99,16 +99,42 @@ fi
99
99
  echo "$NPM_OUTPUT"
100
100
 
101
101
  # ── verify ────────────────────────────────────────────────────────────────────
102
+ # Capture the absolute path resolved here so the setup hand-off below invokes
103
+ # exactly the binary we just verified, instead of re-resolving "visa-cli"
104
+ # through $PATH a second time.
105
+ VISA_BIN=""
102
106
  VISA_VERSION=""
103
- if command -v visa-cli &>/dev/null; then
104
- VISA_VERSION="$(visa-cli --version 2>/dev/null || true)"
107
+ if VISA_BIN="$(command -v visa-cli 2>/dev/null)"; then
108
+ VISA_VERSION="$("$VISA_BIN" --version 2>/dev/null || true)"
105
109
  fi
106
110
 
107
111
  echo ""
108
112
  if [ -n "$VISA_VERSION" ]; then
109
113
  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."
114
+ # Hand off straight into setup so install -> setup -> signed-in is one
115
+ # uninterrupted flow. Hardening:
116
+ # * Auto-launch only when stdin/stdout/stderr are real terminals — setup is
117
+ # interactive (browser sign-in, Touch ID). Piped installs, redirected
118
+ # output, and CI cannot prompt cleanly, so they print the next step.
119
+ # * Invoke "$VISA_BIN" (the path verified just above), never a bare
120
+ # "visa-cli" re-resolved through $PATH at call time.
121
+ # * Pass only the literal "setup" argument — "$@" is never forwarded — so
122
+ # nothing the script's caller controls reaches the installed binary.
123
+ if [ -t 0 ] && [ -t 1 ] && [ -t 2 ]; then
124
+ echo ""
125
+ info "Continuing to setup..."
126
+ echo ""
127
+ "$VISA_BIN" setup || {
128
+ echo ""
129
+ warn "Setup exited before completion. Visa CLI is installed."
130
+ warn "run 'visa-cli setup' when you're ready to finish."
131
+ exit 1
132
+ }
133
+ exit 0
134
+ else
135
+ info "Run 'visa-cli setup' to get started."
136
+ info "After setup, run /mcp inside Claude Code, not Terminal, if Claude Code was already open."
137
+ fi
112
138
  else
113
139
  warn "Installed, but 'visa-cli' was not found on PATH."
114
140
  warn "You may need to restart your shell, then run: visa-cli setup"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visa/cli",
3
- "version": "2.1.0-rc.6",
3
+ "version": "2.1.0-rc.7",
4
4
  "description": "AI-powered payments for Claude Code",
5
5
  "bin": {
6
6
  "visa-cli": "./bin/visa-cli.js"
package/server.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-10-17/server.schema.json",
3
3
  "name": "io.github.visa-crypto-labs/visa-cli",
4
- "version": "2.1.0-rc.6",
4
+ "version": "2.1.0-rc.7",
5
5
  "title": "Visa CLI",
6
6
  "description": "AI-powered payments and creative tools for coding agents. Generate images, music, video, query crypto prices, and make purchases — all from your AI coding assistant.",
7
7
  "websiteUrl": "https://github.com/Visa-Crypto-Labs/Visa-mono/tree/main/packages/cli#readme",
@@ -9,7 +9,7 @@
9
9
  {
10
10
  "registryType": "npm",
11
11
  "identifier": "@visa/cli",
12
- "version": "2.1.0-rc.6",
12
+ "version": "2.1.0-rc.7",
13
13
  "transport": {
14
14
  "type": "stdio"
15
15
  },