rapay 1.0.1 → 1.0.3

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.
Files changed (3) hide show
  1. package/bin/ra +32 -4
  2. package/install.js +16 -5
  3. package/package.json +1 -1
package/bin/ra CHANGED
@@ -1,4 +1,32 @@
1
- #!/bin/sh
2
- # Placeholder - this file will be replaced by install.js with the actual binary
3
- echo "Ra Pay CLI not installed properly. Please reinstall with: npm install -g rapay"
4
- exit 1
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+ const os = require('os');
6
+
7
+ const binDir = __dirname;
8
+ const platform = os.platform();
9
+ const binaryName = platform === 'win32' ? 'ra.exe' : 'ra-binary';
10
+ const binaryPath = path.join(binDir, binaryName);
11
+
12
+ // Check if binary exists
13
+ const fs = require('fs');
14
+ if (!fs.existsSync(binaryPath)) {
15
+ console.error('Ra Pay CLI not installed properly. Please reinstall with: npm install -g rapay');
16
+ process.exit(1);
17
+ }
18
+
19
+ // Spawn the binary with all arguments
20
+ const child = spawn(binaryPath, process.argv.slice(2), {
21
+ stdio: 'inherit',
22
+ windowsHide: true
23
+ });
24
+
25
+ child.on('error', (err) => {
26
+ console.error('Failed to start Ra Pay CLI:', err.message);
27
+ process.exit(1);
28
+ });
29
+
30
+ child.on('close', (code) => {
31
+ process.exit(code || 0);
32
+ });
package/install.js CHANGED
@@ -12,7 +12,7 @@ const path = require('path');
12
12
  const https = require('https');
13
13
  const os = require('os');
14
14
 
15
- const VERSION = '1.0.1';
15
+ const VERSION = '1.0.1'; // CDN binary version (npm package version may differ)
16
16
  const CDN_BASE = 'https://cdn.rapay.ai';
17
17
 
18
18
  // Platform/arch to binary name mapping
@@ -56,8 +56,18 @@ function download(url) {
56
56
  const chunks = [];
57
57
 
58
58
  const request = (url) => {
59
- https.get(url, (response) => {
60
- // Handle redirects (GitHub uses them)
59
+ const urlObj = new URL(url);
60
+ const options = {
61
+ hostname: urlObj.hostname,
62
+ path: urlObj.pathname,
63
+ headers: {
64
+ 'User-Agent': 'rapay-installer/1.0',
65
+ 'Accept': '*/*'
66
+ }
67
+ };
68
+
69
+ https.get(options, (response) => {
70
+ // Handle redirects
61
71
  if (response.statusCode === 301 || response.statusCode === 302) {
62
72
  request(response.headers.location);
63
73
  return;
@@ -105,7 +115,8 @@ async function install() {
105
115
  const binDir = path.join(__dirname, 'bin');
106
116
  const platform = os.platform();
107
117
  const binaryName = getBinaryName();
108
- const destName = platform === 'win32' ? 'ra.exe' : 'ra';
118
+ // Windows: ra.exe, Unix: ra-binary (launcher script handles dispatch)
119
+ const destName = platform === 'win32' ? 'ra.exe' : 'ra-binary';
109
120
  const destPath = path.join(binDir, destName);
110
121
  const binaryUrl = getDownloadUrl(binaryName);
111
122
  const checksumsUrl = getDownloadUrl('checksums.txt');
@@ -179,7 +190,7 @@ async function install() {
179
190
  console.error('Failed to install Ra Pay CLI:', error.message);
180
191
  console.error('');
181
192
  console.error('You can manually download the binary from:');
182
- console.error(`https://github.com/${REPO}/releases/tag/v${VERSION}`);
193
+ console.error(`${CDN_BASE}/v${VERSION}/`);
183
194
  process.exit(1);
184
195
  }
185
196
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rapay",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "CLI-native payment infrastructure for AI agents. Send fiat USD payments via Stripe without browser automation.",
5
5
  "keywords": [
6
6
  "cli",