reepoe 1.1.4 → 1.1.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/bin/reepoe.js CHANGED
@@ -94,32 +94,39 @@ MORE INFO:
94
94
 
95
95
  async function makeQuery(query) {
96
96
  const axios = require('axios');
97
- const configPath = path.join(process.cwd(), 'reepoe.config.json');
98
97
 
99
- // Read config to get port
100
- let port = 8000;
101
- if (fs.existsSync(configPath)) {
102
- try {
103
- const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
104
- port = config.api?.port || 8000;
105
- } catch (e) {
106
- // Use default port
107
- }
108
- }
109
-
110
- // Load activation to get user email for per-user metrics
98
+ // Load activation to get user email and API URL
111
99
  let userEmail = null;
100
+ let apiBase = null;
112
101
  const activationPath = path.join(os.homedir(), '.reepoe', 'activation.json');
102
+
113
103
  if (fs.existsSync(activationPath)) {
114
104
  try {
115
105
  const activation = JSON.parse(fs.readFileSync(activationPath, 'utf8'));
116
106
  userEmail = activation.email;
107
+ apiBase = activation.api_base;
117
108
  } catch (e) {
118
- // No activation or invalid - metrics will be aggregate only
109
+ console.error('āŒ Failed to load activation. Run: reepoe-start');
110
+ process.exit(1);
111
+ }
112
+ }
113
+
114
+ // If no API base from activation, try localhost
115
+ if (!apiBase) {
116
+ const configPath = path.join(process.cwd(), 'reepoe.config.json');
117
+ let port = 8000;
118
+ if (fs.existsSync(configPath)) {
119
+ try {
120
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
121
+ port = config.api?.port || 8000;
122
+ } catch (e) {
123
+ // Use default port
124
+ }
119
125
  }
126
+ apiBase = `http://localhost:${port}`;
120
127
  }
121
128
 
122
- const url = `http://localhost:${port}/query`;
129
+ const url = `${apiBase}/query`;
123
130
 
124
131
  try {
125
132
  console.log(`\nšŸ¤– ReePoe processing: "${query}"\n`);
@@ -127,11 +134,13 @@ async function makeQuery(query) {
127
134
  if (userEmail) {
128
135
  requestBody.user_email = userEmail;
129
136
  }
130
- const response = await axios.post(url, requestBody);
137
+ const response = await axios.post(url, requestBody, { timeout: 60000 });
131
138
  console.log(response.data.response || response.data);
132
139
  } catch (error) {
133
140
  if (error.code === 'ECONNREFUSED') {
134
- console.error('āŒ ReePoe server not running. Start it with: reepoe-start');
141
+ console.error('āŒ Cannot connect to ReePoe API');
142
+ console.error(` Tried: ${apiBase}`);
143
+ console.error(' Run: reepoe-start');
135
144
  } else {
136
145
  console.error(`āŒ Query failed: ${error.message}`);
137
146
  }
package/bin/start.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * ReePoe Start - Starts ReePoe server in background
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
- return path.join(__dirname, '../binaries', binaryName);
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 (!fs.existsSync(binaryPath)) {
197
- console.error(`āŒ ReePoe binary not found: ${binaryPath}`);
198
- console.error(' Try reinstalling: npm install -g @reepoe/plugin');
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
 
@@ -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 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reepoe",
3
- "version": "1.1.4",
3
+ "version": "1.1.7",
4
4
  "description": "ReePoe AI Code Manager - Install in any codebase for instant AI agent integration",
5
5
  "keywords": [
6
6
  "ai",