@visa/cli 4.1.0-rc.26 → 4.1.0-rc.260
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 +202 -46
- package/dist/checkout-engine/adapters/generic.d.ts +69 -0
- package/dist/checkout-engine/adapters/generic.js +383 -58
- package/dist/checkout-engine/adapters/index.d.ts +4 -1
- package/dist/checkout-engine/adapters/index.js +10 -3
- package/dist/checkout-engine/adapters/shopify.d.ts +80 -0
- package/dist/checkout-engine/adapters/shopify.js +688 -0
- package/dist/checkout-engine/amount.d.ts +15 -0
- package/dist/checkout-engine/amount.js +72 -0
- package/dist/checkout-engine/browser-launch.d.ts +9 -4
- package/dist/checkout-engine/browser-launch.js +19 -4
- package/dist/checkout-engine/browserbase-browser.d.ts +24 -0
- package/dist/checkout-engine/browserbase-browser.js +186 -0
- package/dist/checkout-engine/cli-engine.d.ts +206 -32
- package/dist/checkout-engine/cli-engine.js +772 -216
- package/dist/checkout-engine/confirmed-merchants.d.ts +31 -0
- package/dist/checkout-engine/confirmed-merchants.js +165 -0
- package/dist/checkout-engine/detect.d.ts +1 -1
- package/dist/checkout-engine/detect.js +6 -0
- package/dist/checkout-engine/evidence.d.ts +1 -1
- package/dist/checkout-engine/executor.d.ts +61 -3
- package/dist/checkout-engine/executor.js +550 -144
- package/dist/checkout-engine/hosted-approval.d.ts +69 -9
- package/dist/checkout-engine/hosted-approval.js +211 -21
- package/dist/checkout-engine/index.d.ts +6 -2
- package/dist/checkout-engine/index.js +5 -1
- package/dist/checkout-engine/instrument.d.ts +6 -0
- package/dist/checkout-engine/known-merchants.d.ts +10 -0
- package/dist/checkout-engine/known-merchants.js +38 -0
- package/dist/checkout-engine/live-fill-approval.d.ts +5 -11
- package/dist/checkout-engine/live-fill-approval.js +20 -34
- package/dist/checkout-engine/mandate/card-mandate.d.ts +6 -2
- package/dist/checkout-engine/mandate/card-mandate.js +10 -5
- package/dist/checkout-engine/mandate/mandate-ledger.d.ts +63 -23
- package/dist/checkout-engine/mandate/mandate-ledger.js +124 -17
- package/dist/checkout-engine/receipt-dir.d.ts +6 -0
- package/dist/checkout-engine/receipt-dir.js +8 -0
- package/dist/checkout-engine/receipt.d.ts +56 -2
- package/dist/checkout-engine/receipt.js +55 -16
- package/dist/checkout-engine/shopify-primary-domain.d.ts +25 -0
- package/dist/checkout-engine/shopify-primary-domain.js +96 -0
- package/dist/checkout-engine/trace-handles.d.ts +8 -0
- package/dist/checkout-engine/trace-handles.js +12 -0
- package/dist/checkout-engine/types.d.ts +15 -2
- package/dist/checkout-engine/unresolved-charges.d.ts +34 -0
- package/dist/checkout-engine/unresolved-charges.js +134 -0
- package/dist/checkout-engine/vgs-gateway/server-mint-client.d.ts +26 -7
- package/dist/checkout-engine/vgs-gateway/server-mint-client.js +43 -3
- package/dist/checkout-engine/vgs-live-instrument.d.ts +11 -35
- package/dist/checkout-engine/vgs-live-instrument.js +14 -74
- package/dist/checkout-engine/vic-confirmation.d.ts +18 -0
- package/dist/checkout-engine/vic-confirmation.js +9 -3
- package/dist/checkout-engine/web-bot-auth.d.ts +98 -0
- package/dist/checkout-engine/web-bot-auth.js +218 -0
- package/dist/cli.js +899 -387
- package/dist/mcp-apps/ucp-checkout.html +280 -0
- package/dist/mcp-server/index.js +725 -254
- package/dist/merchant-ucp-mcp/index.js +6 -0
- package/dist/skills/pair-visa-agent/RUNTIMES.md +122 -79
- package/dist/skills/pair-visa-agent/SKILL.md +433 -318
- package/dist/skills/pair-visa-agent/scripts/__tests__/setup.test.mjs +407 -0
- package/dist/skills/pair-visa-agent/scripts/setup.mjs +310 -30
- package/dist/skills/visa-shopify-checkout/SKILL.md +122 -0
- package/dist/skills/visa-shopify-checkout/references/evidence-and-states.md +37 -0
- package/dist/skills/visa-ucp-shopping/SKILL.md +86 -0
- package/dist/subway-direct.mjs +1 -0
- package/install.ps1 +7 -6
- package/install.sh +3 -3
- package/native/bin/win32-x64/visa-keychain-win.exe +0 -0
- package/package.json +31 -28
- package/server.json +4 -4
- package/dist/checkout-engine/inline-target.d.ts +0 -13
- package/dist/checkout-engine/inline-target.js +0 -37
- package/dist/checkout-engine/pay-args.d.ts +0 -14
- package/dist/checkout-engine/pay-args.js +0 -44
- package/dist/checkout-engine/pay.d.ts +0 -1
- package/dist/checkout-engine/pay.js +0 -13
- package/dist/checkout-engine/repo-env.d.ts +0 -11
- package/dist/checkout-engine/repo-env.js +0 -23
- package/dist/checkout-engine/run-live-fill.d.ts +0 -1
- package/dist/checkout-engine/run-live-fill.js +0 -493
- package/dist/checkout-engine/vgs-gateway/fetch-credential.d.mts +0 -74
- package/dist/checkout-engine/vgs-gateway/fetch-credential.mjs +0 -248
package/install.ps1
CHANGED
|
@@ -108,8 +108,8 @@ try {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
$major = [int]$nodeMatch.Groups['major'].Value
|
|
111
|
-
if ($major -lt
|
|
112
|
-
Write-Host " Node.js $nodeVersion is too old. Version
|
|
111
|
+
if ($major -lt 20) {
|
|
112
|
+
Write-Host " Node.js $nodeVersion is too old. Version 20+ required." -ForegroundColor Red
|
|
113
113
|
Write-Host " Install from https://nodejs.org/ and try again." -ForegroundColor Yellow
|
|
114
114
|
Wait-BeforeExit
|
|
115
115
|
exit 1
|
|
@@ -137,8 +137,9 @@ try {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
# Install via npm
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
$Package = '@visa/cli@rc'
|
|
141
|
+
Write-Host " Running: npm install -g $Package" -ForegroundColor Gray
|
|
142
|
+
$npmOutput = & npm install -g $Package 2>&1
|
|
142
143
|
$npmExitCode = $LASTEXITCODE
|
|
143
144
|
$npmText = ($npmOutput | Out-String)
|
|
144
145
|
$npmOutput | Out-Host
|
|
@@ -158,7 +159,7 @@ if ($npmExitCode -ne 0) {
|
|
|
158
159
|
Write-Host " Do not disable TLS verification globally." -ForegroundColor Yellow
|
|
159
160
|
} else {
|
|
160
161
|
Write-Host " Run manually for the full error, then retry:" -ForegroundColor Yellow
|
|
161
|
-
Write-Host " npm install -g
|
|
162
|
+
Write-Host " npm install -g $Package" -ForegroundColor Yellow
|
|
162
163
|
}
|
|
163
164
|
|
|
164
165
|
Wait-BeforeExit
|
|
@@ -188,7 +189,7 @@ Write-Host ""
|
|
|
188
189
|
if ($verifiedCommand) {
|
|
189
190
|
Write-Host " Visa CLI $visaVersion installed." -ForegroundColor Green
|
|
190
191
|
Write-Host " Connect an AI client with: $verifiedCommand connect <client>" -ForegroundColor Cyan
|
|
191
|
-
Write-Host " Then ask your agent to call
|
|
192
|
+
Write-Host " Then ask your agent to call setup_start." -ForegroundColor Cyan
|
|
192
193
|
Write-Host ""
|
|
193
194
|
} else {
|
|
194
195
|
$primaryCommand = $cliCommandNames | Select-Object -First 1
|
package/install.sh
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
_visa_install() {
|
|
11
11
|
set -euo pipefail
|
|
12
12
|
|
|
13
|
-
REQUIRED_NODE_MAJOR=
|
|
14
|
-
PACKAGE="@visa/cli"
|
|
13
|
+
REQUIRED_NODE_MAJOR=20
|
|
14
|
+
PACKAGE="@visa/cli@rc"
|
|
15
15
|
|
|
16
16
|
# ── colours (disabled when piped) ─────────────────────────────────────────────
|
|
17
17
|
if [ -t 1 ]; then
|
|
@@ -109,7 +109,7 @@ echo ""
|
|
|
109
109
|
if [ -n "$VISA_VERSION" ]; then
|
|
110
110
|
ok "Visa CLI ${VISA_VERSION} installed."
|
|
111
111
|
info "Connect an AI client with: visa-cli connect <client>"
|
|
112
|
-
info "Then ask your agent to call
|
|
112
|
+
info "Then ask your agent to call setup_start."
|
|
113
113
|
else
|
|
114
114
|
warn "Installed, but 'visa-cli' was not found on PATH."
|
|
115
115
|
warn "Restart your shell, then run: visa-cli connect <client>"
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visa/cli",
|
|
3
|
-
"version": "4.1.0-rc.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.1.0-rc.260",
|
|
4
|
+
"description": "Visa CLI runtime for stable agent identity and separately authorized payment capabilities",
|
|
5
5
|
"bin": {
|
|
6
6
|
"visa-cli": "./bin/visa-cli.js",
|
|
7
7
|
"visa": "./bin/visa-cli.js"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"scripts": {
|
|
10
10
|
"sync:server-json": "node scripts/sync-server-json.mjs",
|
|
11
11
|
"check:server-json": "node scripts/sync-server-json.mjs --check",
|
|
12
|
-
"prebuild": "node scripts/sync-server-json.mjs && pnpm --filter @visa/money build && pnpm --filter @visa/crypto build && pnpm --filter subway-sdk build && pnpm --filter @visa-cli/tools build && pnpm --filter @visa/identity build && pnpm --filter @visa/wallet build && pnpm --filter @visa/agent-mail build && pnpm --filter @visa/wallet-tools build && pnpm --filter @visa/checkout-engine build",
|
|
12
|
+
"prebuild": "node scripts/sync-server-json.mjs && pnpm --filter @visa/shared build && pnpm --filter @visa/observability build && pnpm --filter @visa/money build && pnpm --filter @visa/crypto build && pnpm --filter subway-sdk build && pnpm --filter @visa-cli/tools build && pnpm --filter @visa/identity build && pnpm --filter @visa/wallet build && pnpm --filter @visa/agent-mail build && pnpm --filter @visa/wallet-tools build && pnpm --filter @visa/checkout-engine build",
|
|
13
13
|
"build": "tsc --noEmit && node esbuild.config.js",
|
|
14
14
|
"prepack": "node scripts/sync-server-json.mjs --check",
|
|
15
15
|
"dev": "tsc --watch",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"test:unit:watch": "jest --config jest.config.js --watch",
|
|
21
21
|
"test:unit:coverage": "jest --config jest.config.js --coverage",
|
|
22
22
|
"test:smoke": "VISA_AUTH_URL=https://auth.visacli.sh jest --config jest.smoke.config.js",
|
|
23
|
+
"test:packed": "node scripts/packed-cli-smoke.mjs",
|
|
23
24
|
"test:integration": "jest --config jest.integration.config.js",
|
|
24
25
|
"test:e2e": "jest --config jest.e2e.config.js",
|
|
25
|
-
"test:catalog-e2e": "jest --config jest.catalog-e2e.config.js",
|
|
26
26
|
"test:all": "npm run test:unit && npm run test:integration && npm run test:e2e",
|
|
27
27
|
"prepublishOnly": "npm run build && npm test",
|
|
28
28
|
"lint": "eslint src/**/*.ts",
|
|
@@ -42,48 +42,52 @@
|
|
|
42
42
|
"author": "Visa Crypto Labs",
|
|
43
43
|
"license": "SEE LICENSE IN LICENSE",
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@modelcontextprotocol/
|
|
45
|
+
"@modelcontextprotocol/ext-apps": "1.7.5",
|
|
46
|
+
"@modelcontextprotocol/server": "2.0.0",
|
|
47
|
+
"@ucp-js/sdk": "0.4.4",
|
|
46
48
|
"commander": "^12.1.0",
|
|
47
|
-
"
|
|
49
|
+
"punycode": "^2.3.1",
|
|
50
|
+
"toml": "^4.3.0",
|
|
51
|
+
"yaml": "^2.9.0",
|
|
52
|
+
"zod": "^3.25.76"
|
|
48
53
|
},
|
|
49
54
|
"optionalDependencies": {
|
|
50
|
-
"libp2p": "^3.3.4",
|
|
51
|
-
"@libp2p/tcp": "^11.0.22",
|
|
52
|
-
"@libp2p/crypto": "^5.1.20",
|
|
53
55
|
"@chainsafe/libp2p-noise": "^17.0.0",
|
|
54
56
|
"@chainsafe/libp2p-yamux": "^8.0.1",
|
|
57
|
+
"@libp2p/crypto": "^5.1.23",
|
|
58
|
+
"@libp2p/tcp": "^11.0.26",
|
|
55
59
|
"@multiformats/multiaddr": "^13.0.3",
|
|
56
|
-
"
|
|
57
|
-
"playwright-core": "^1.
|
|
60
|
+
"libp2p": "^3.3.9",
|
|
61
|
+
"playwright-core": "^1.62.1",
|
|
62
|
+
"uint8arrays": "^6.1.1"
|
|
58
63
|
},
|
|
59
64
|
"devDependencies": {
|
|
65
|
+
"@types/express": "^5.0.0",
|
|
66
|
+
"@types/jest": "^30.0.0",
|
|
67
|
+
"@types/node": "^26.1.0",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^8.68.0",
|
|
69
|
+
"@typescript-eslint/parser": "^8.68.0",
|
|
70
|
+
"@visa-cli/tools": "workspace:*",
|
|
71
|
+
"@visa/agent-mail": "workspace:*",
|
|
60
72
|
"@visa/checkout-engine": "workspace:*",
|
|
61
73
|
"@visa/crypto": "workspace:*",
|
|
62
74
|
"@visa/identity": "workspace:*",
|
|
63
|
-
"subway-sdk": "workspace:*",
|
|
64
75
|
"@visa/money": "workspace:*",
|
|
76
|
+
"@visa/observability": "workspace:*",
|
|
77
|
+
"@visa/shared": "workspace:*",
|
|
65
78
|
"@visa/wallet": "workspace:*",
|
|
66
79
|
"@visa/wallet-tools": "workspace:*",
|
|
67
|
-
"@visa/observability": "workspace:*",
|
|
68
|
-
"@visa-cli/tools": "workspace:*",
|
|
69
|
-
"@changesets/changelog-git": "^0.2.1",
|
|
70
|
-
"@changesets/cli": "^2.31.0",
|
|
71
|
-
"@types/jest": "^30.0.0",
|
|
72
|
-
"@types/node": "^26.1.0",
|
|
73
|
-
"@typescript-eslint/eslint-plugin": "^8.65.0",
|
|
74
|
-
"@typescript-eslint/parser": "^8.65.0",
|
|
75
|
-
"@types/express": "^5.0.0",
|
|
76
80
|
"esbuild": "^0.28.1",
|
|
77
|
-
"express": "^4.21.0",
|
|
78
81
|
"eslint": "^10.0.2",
|
|
79
|
-
"
|
|
82
|
+
"express": "^4.21.0",
|
|
80
83
|
"jest": "^29.7.0",
|
|
81
|
-
"prettier": "^3.9.
|
|
82
|
-
"
|
|
84
|
+
"prettier": "^3.9.6",
|
|
85
|
+
"subway-sdk": "workspace:*",
|
|
86
|
+
"ts-jest": "^29.4.12",
|
|
83
87
|
"typescript": "^5.7.0"
|
|
84
88
|
},
|
|
85
89
|
"engines": {
|
|
86
|
-
"node": ">=
|
|
90
|
+
"node": ">=20.0.0"
|
|
87
91
|
},
|
|
88
92
|
"mcpName": "io.github.visa-crypto-labs/visa-cli",
|
|
89
93
|
"files": [
|
|
@@ -96,7 +100,6 @@
|
|
|
96
100
|
"native/build-win.bat",
|
|
97
101
|
"native/bin/win32-x64/visa-keychain-win.exe",
|
|
98
102
|
"server.json",
|
|
99
|
-
"README.md"
|
|
100
|
-
"LICENSE"
|
|
103
|
+
"README.md"
|
|
101
104
|
]
|
|
102
105
|
}
|
package/server.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.visa-crypto-labs/visa-cli",
|
|
4
|
-
"version": "4.1.0-rc.
|
|
4
|
+
"version": "4.1.0-rc.260",
|
|
5
5
|
"title": "Visa CLI",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Pair a human-approved agent identity, configure payment capabilities separately, and discover and pay x402 services from your AI coding assistant.",
|
|
7
7
|
"websiteUrl": "https://github.com/Visa-Crypto-Labs/Visa-mono/tree/main/packages/cli#readme",
|
|
8
8
|
"packages": [
|
|
9
9
|
{
|
|
10
10
|
"registryType": "npm",
|
|
11
11
|
"identifier": "@visa/cli",
|
|
12
|
-
"version": "4.1.0-rc.
|
|
12
|
+
"version": "4.1.0-rc.260",
|
|
13
13
|
"transport": {
|
|
14
14
|
"type": "stdio"
|
|
15
15
|
},
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { VgsCheckoutTarget } from './vgs-live-instrument.js';
|
|
2
|
-
/**
|
|
3
|
-
* Build a checkout target from inline CLI flags (`--merchant-url` +
|
|
4
|
-
* `--amount`, with optional `--merchant-name` / `--country` / `--currency`)
|
|
5
|
-
* so any merchant can be paid without authoring a checkout JSON file first.
|
|
6
|
-
*
|
|
7
|
-
* Returns null when neither driving flag is present (file mode). Shape-only:
|
|
8
|
-
* the returned target flows through run-live-fill's existing validation block
|
|
9
|
-
* (positive-decimal amount, ISO codes, HTTPS), which stays the single source
|
|
10
|
-
* of truth — nothing is double-validated here except the URL parse, which
|
|
11
|
-
* must happen early because the merchant-name default derives from it.
|
|
12
|
-
*/
|
|
13
|
-
export declare function inlineTargetFromFlags(input: Map<string, string>): VgsCheckoutTarget | null;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build a checkout target from inline CLI flags (`--merchant-url` +
|
|
3
|
-
* `--amount`, with optional `--merchant-name` / `--country` / `--currency`)
|
|
4
|
-
* so any merchant can be paid without authoring a checkout JSON file first.
|
|
5
|
-
*
|
|
6
|
-
* Returns null when neither driving flag is present (file mode). Shape-only:
|
|
7
|
-
* the returned target flows through run-live-fill's existing validation block
|
|
8
|
-
* (positive-decimal amount, ISO codes, HTTPS), which stays the single source
|
|
9
|
-
* of truth — nothing is double-validated here except the URL parse, which
|
|
10
|
-
* must happen early because the merchant-name default derives from it.
|
|
11
|
-
*/
|
|
12
|
-
export function inlineTargetFromFlags(input) {
|
|
13
|
-
const merchantUrl = input.get('--merchant-url');
|
|
14
|
-
const amount = input.get('--amount');
|
|
15
|
-
if (merchantUrl === undefined && amount === undefined)
|
|
16
|
-
return null;
|
|
17
|
-
if (!merchantUrl || !amount) {
|
|
18
|
-
throw new Error('inline checkout needs both --merchant-url and --amount');
|
|
19
|
-
}
|
|
20
|
-
let host;
|
|
21
|
-
try {
|
|
22
|
-
host = new URL(merchantUrl).hostname;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
throw new Error('--merchant-url must be a valid URL');
|
|
26
|
-
}
|
|
27
|
-
if (!host) {
|
|
28
|
-
throw new Error('--merchant-url must have a hostname');
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
merchantName: input.get('--merchant-name') ?? host,
|
|
32
|
-
merchantUrl,
|
|
33
|
-
merchantCountryCode: input.get('--country') ?? 'US',
|
|
34
|
-
transactionAmount: amount,
|
|
35
|
-
transactionCurrencyCode: input.get('--currency') ?? 'USD',
|
|
36
|
-
};
|
|
37
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Argv rewriter for the `pnpm pay` positional entry point, extracted pure so
|
|
3
|
-
* it is unit-testable (the pay.ts script executes on import). Maps
|
|
4
|
-
* `<checkout-url> <amount> [flags]` onto run-live-fill's inline flags.
|
|
5
|
-
*
|
|
6
|
-
* Strict by design — this drives a real-money run:
|
|
7
|
-
* - `--merchant-url`/`--amount` are REJECTED as passthrough flags: the
|
|
8
|
-
* runner's arg map lets a later flag win, so a stray duplicate would
|
|
9
|
-
* silently retarget the purchase away from the typed positionals.
|
|
10
|
-
* - Every flag must carry a value (same grammar as run-live-fill's args()),
|
|
11
|
-
* so a trailing bare flag fails HERE with pay's usage, not downstream with
|
|
12
|
-
* fill:live's.
|
|
13
|
-
*/
|
|
14
|
-
export declare function rewritePayArgs(argv: string[]): string[];
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Argv rewriter for the `pnpm pay` positional entry point, extracted pure so
|
|
3
|
-
* it is unit-testable (the pay.ts script executes on import). Maps
|
|
4
|
-
* `<checkout-url> <amount> [flags]` onto run-live-fill's inline flags.
|
|
5
|
-
*
|
|
6
|
-
* Strict by design — this drives a real-money run:
|
|
7
|
-
* - `--merchant-url`/`--amount` are REJECTED as passthrough flags: the
|
|
8
|
-
* runner's arg map lets a later flag win, so a stray duplicate would
|
|
9
|
-
* silently retarget the purchase away from the typed positionals.
|
|
10
|
-
* - Every flag must carry a value (same grammar as run-live-fill's args()),
|
|
11
|
-
* so a trailing bare flag fails HERE with pay's usage, not downstream with
|
|
12
|
-
* fill:live's.
|
|
13
|
-
*/
|
|
14
|
-
const USAGE = 'usage: pnpm pay -- <checkout-url> <amount> [--merchant-name <name>] ' +
|
|
15
|
-
'[--country <CC>] [--currency <ISO>] [--mode dry-run|submit] [--contact-file <path>] ' +
|
|
16
|
-
'[--agent-credential-file <path>] [--approval-base-url <url>]';
|
|
17
|
-
const RESERVED_FLAGS = ['--merchant-url', '--amount'];
|
|
18
|
-
export function rewritePayArgs(argv) {
|
|
19
|
-
// pnpm forwards the literal `--` separator; drop it like run-live-fill does.
|
|
20
|
-
const tokens = argv.filter((a) => a !== '--');
|
|
21
|
-
const positionals = [];
|
|
22
|
-
const flags = [];
|
|
23
|
-
for (let i = 0; i < tokens.length; i++) {
|
|
24
|
-
const token = tokens[i];
|
|
25
|
-
if (token.startsWith('--')) {
|
|
26
|
-
if (RESERVED_FLAGS.includes(token)) {
|
|
27
|
-
throw new Error(`${token} is derived from the positionals — pass the url and amount ` +
|
|
28
|
-
`positionally instead of as flags\n${USAGE}`);
|
|
29
|
-
}
|
|
30
|
-
const value = tokens[i + 1];
|
|
31
|
-
if (value === undefined || value.startsWith('--')) {
|
|
32
|
-
throw new Error(`flag ${token} needs a value\n${USAGE}`);
|
|
33
|
-
}
|
|
34
|
-
flags.push(token, value);
|
|
35
|
-
i++;
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
positionals.push(token);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (positionals.length !== 2)
|
|
42
|
-
throw new Error(USAGE);
|
|
43
|
-
return ['--merchant-url', positionals[0], '--amount', positionals[1], ...flags];
|
|
44
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Positional sugar over run-live-fill's inline any-merchant mode:
|
|
3
|
-
*
|
|
4
|
-
* pnpm pay -- <checkout-url> <amount> [--mode submit] [--merchant-name "X"] [...]
|
|
5
|
-
*
|
|
6
|
-
* Rewrites the two positionals into --merchant-url/--amount (pay-args.ts,
|
|
7
|
-
* strict) and re-enters the runner, so every guardrail (typed PAY approval,
|
|
8
|
-
* CHECKOUT_AGENT_ALLOW_SUBMIT, hosted/loopback ceremony, receipts) is exactly
|
|
9
|
-
* the fill:live path — this file must never grow logic of its own.
|
|
10
|
-
*/
|
|
11
|
-
import { rewritePayArgs } from './pay-args.js';
|
|
12
|
-
process.argv = [process.argv[0], process.argv[1], ...rewritePayArgs(process.argv.slice(2))];
|
|
13
|
-
await import('./run-live-fill.js');
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load the monorepo root `.env` as DEFAULTS for the runner, so stable
|
|
3
|
-
* per-machine config (VGS credentials, CHECKOUT_APPROVAL_BASE_URL,
|
|
4
|
-
* CHECKOUT_AGENT_ALLOW_SUBMIT, CHECKOUT_AGENT_MODE) is set once instead of
|
|
5
|
-
* retyped on every invocation. `process.loadEnvFile` never overrides
|
|
6
|
-
* variables already present in the environment (verified: shell always wins),
|
|
7
|
-
* so an explicit `FOO=x pnpm pay …` still beats the file. A missing file is
|
|
8
|
-
* fine — the runner then relies on the ambient environment exactly as before.
|
|
9
|
-
*/
|
|
10
|
-
export declare function defaultRepoEnvPath(): string;
|
|
11
|
-
export declare function loadRepoEnvDefaults(path?: string, log?: (line: string) => void): boolean;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { fileURLToPath } from 'node:url';
|
|
2
|
-
/**
|
|
3
|
-
* Load the monorepo root `.env` as DEFAULTS for the runner, so stable
|
|
4
|
-
* per-machine config (VGS credentials, CHECKOUT_APPROVAL_BASE_URL,
|
|
5
|
-
* CHECKOUT_AGENT_ALLOW_SUBMIT, CHECKOUT_AGENT_MODE) is set once instead of
|
|
6
|
-
* retyped on every invocation. `process.loadEnvFile` never overrides
|
|
7
|
-
* variables already present in the environment (verified: shell always wins),
|
|
8
|
-
* so an explicit `FOO=x pnpm pay …` still beats the file. A missing file is
|
|
9
|
-
* fine — the runner then relies on the ambient environment exactly as before.
|
|
10
|
-
*/
|
|
11
|
-
export function defaultRepoEnvPath() {
|
|
12
|
-
return fileURLToPath(new URL('../../../.env', import.meta.url));
|
|
13
|
-
}
|
|
14
|
-
export function loadRepoEnvDefaults(path = defaultRepoEnvPath(), log = (line) => process.stdout.write(`${line}\n`)) {
|
|
15
|
-
try {
|
|
16
|
-
process.loadEnvFile(path);
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return false;
|
|
20
|
-
}
|
|
21
|
-
log(`loaded env defaults from ${path} (already-set variables win)`);
|
|
22
|
-
return true;
|
|
23
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|