reepoe 1.1.3 ā 1.1.5
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/bin/reepoe.js +6 -3
- package/bin/start.js +28 -5
- package/lib/activation-client.js +9 -1
- package/package.json +1 -1
package/bin/reepoe.js
CHANGED
|
@@ -107,19 +107,22 @@ async function makeQuery(query) {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
// Load activation to get user email
|
|
110
|
+
// Load activation to get user email and API URL
|
|
111
111
|
let userEmail = null;
|
|
112
|
+
let apiBase = `http://localhost:${port}`;
|
|
112
113
|
const activationPath = path.join(os.homedir(), '.reepoe', 'activation.json');
|
|
113
114
|
if (fs.existsSync(activationPath)) {
|
|
114
115
|
try {
|
|
115
116
|
const activation = JSON.parse(fs.readFileSync(activationPath, 'utf8'));
|
|
116
117
|
userEmail = activation.email;
|
|
118
|
+
// Use API base from activation (for cloud environments)
|
|
119
|
+
apiBase = activation.api_base || `http://localhost:${port}`;
|
|
117
120
|
} catch (e) {
|
|
118
|
-
// No activation or invalid -
|
|
121
|
+
// No activation or invalid - use localhost
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
|
|
122
|
-
const url =
|
|
125
|
+
const url = `${apiBase}/query`;
|
|
123
126
|
|
|
124
127
|
try {
|
|
125
128
|
console.log(`\nš¤ ReePoe processing: "${query}"\n`);
|
package/bin/start.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* ReePoe Start -
|
|
3
|
+
* ReePoe Start - Hybrid local/cloud startup
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const { spawn } = require('child_process');
|
|
@@ -9,6 +9,15 @@ const fs = require('fs');
|
|
|
9
9
|
const os = require('os');
|
|
10
10
|
const axios = require('axios');
|
|
11
11
|
|
|
12
|
+
// Detect cloud environment
|
|
13
|
+
function isCloudEnvironment() {
|
|
14
|
+
return !!(
|
|
15
|
+
process.env.REPL_ID || // Replit
|
|
16
|
+
process.env.CODESPACE_NAME || // GitHub Codespaces
|
|
17
|
+
process.env.GITPOD_WORKSPACE_ID // Gitpod
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
12
21
|
// Get binary path
|
|
13
22
|
function getBinaryPath() {
|
|
14
23
|
const platform = os.platform();
|
|
@@ -23,7 +32,8 @@ function getBinaryPath() {
|
|
|
23
32
|
binaryName = 'reepoe-windows.exe';
|
|
24
33
|
}
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
const binaryPath = path.join(__dirname, '../binaries', binaryName);
|
|
36
|
+
return fs.existsSync(binaryPath) ? binaryPath : null;
|
|
27
37
|
}
|
|
28
38
|
|
|
29
39
|
// Check if server is already running
|
|
@@ -181,6 +191,19 @@ async function main() {
|
|
|
181
191
|
console.log('ā¹ļø No configuration found, using defaults');
|
|
182
192
|
}
|
|
183
193
|
|
|
194
|
+
// Detect cloud environment
|
|
195
|
+
const isCloud = isCloudEnvironment();
|
|
196
|
+
|
|
197
|
+
if (isCloud) {
|
|
198
|
+
// Cloud environment - skip local server
|
|
199
|
+
console.log('\nāļø Cloud environment detected');
|
|
200
|
+
console.log('š” Using production ReePoe API: https://reepoe-api.onrender.com\n');
|
|
201
|
+
console.log('ā
Ready to use!');
|
|
202
|
+
console.log('\nš” Try:');
|
|
203
|
+
console.log(' reepoe query "test query"\n');
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
|
|
184
207
|
// Check if already running
|
|
185
208
|
const running = await isServerRunning(port);
|
|
186
209
|
if (running) {
|
|
@@ -193,9 +216,9 @@ async function main() {
|
|
|
193
216
|
// Get binary path
|
|
194
217
|
const binaryPath = getBinaryPath();
|
|
195
218
|
|
|
196
|
-
if (!
|
|
197
|
-
console.error(`ā ReePoe binary not found
|
|
198
|
-
console.error(' Try reinstalling: npm install -g
|
|
219
|
+
if (!binaryPath) {
|
|
220
|
+
console.error(`ā ReePoe binary not found for ${os.platform()}-${os.arch()}`);
|
|
221
|
+
console.error(' Try reinstalling: npm install -g reepoe');
|
|
199
222
|
process.exit(1);
|
|
200
223
|
}
|
|
201
224
|
|
package/lib/activation-client.js
CHANGED
|
@@ -231,12 +231,20 @@ class ActivationClient {
|
|
|
231
231
|
fs.mkdirSync(configDir, { recursive: true, mode: 0o700 });
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
// Detect cloud environment
|
|
235
|
+
const isCloud = !!(
|
|
236
|
+
process.env.REPL_ID ||
|
|
237
|
+
process.env.CODESPACE_NAME ||
|
|
238
|
+
process.env.GITPOD_WORKSPACE_ID
|
|
239
|
+
);
|
|
240
|
+
|
|
234
241
|
const data = {
|
|
235
242
|
email: activationData.user?.email || activationData.email,
|
|
236
243
|
token: activationData.token,
|
|
237
244
|
activated_at: activationData.user?.activated_at || new Date().toISOString(),
|
|
238
245
|
expires_at: activationData.user?.expires_at,
|
|
239
|
-
status: activationData.user?.status || 'active'
|
|
246
|
+
status: activationData.user?.status || 'active',
|
|
247
|
+
api_base: isCloud ? 'https://reepoe-api.onrender.com' : 'http://localhost:8000'
|
|
240
248
|
};
|
|
241
249
|
|
|
242
250
|
fs.writeFileSync(this.activationFile, JSON.stringify(data, null, 2), { mode: 0o600 });
|