reepoe 1.1.1

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 ADDED
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ReePoe CLI - Main command wrapper
4
+ * Manages ReePoe binary execution and queries
5
+ */
6
+
7
+ const { spawn } = require('child_process');
8
+ const path = require('path');
9
+ const fs = require('fs');
10
+ const os = require('os');
11
+
12
+ // Get binary path based on platform
13
+ function getBinaryPath() {
14
+ const platform = os.platform();
15
+ const arch = os.arch();
16
+
17
+ let binaryName;
18
+ if (platform === 'darwin') {
19
+ binaryName = arch === 'arm64' ? 'reepoe-macos-arm64' : 'reepoe-macos-x64';
20
+ } else if (platform === 'linux') {
21
+ binaryName = 'reepoe-linux-x64';
22
+ } else if (platform === 'win32') {
23
+ binaryName = 'reepoe-windows.exe';
24
+ } else {
25
+ console.error(`❌ Unsupported platform: ${platform}`);
26
+ process.exit(1);
27
+ }
28
+
29
+ const binaryPath = path.join(__dirname, '../binaries', binaryName);
30
+
31
+ if (!fs.existsSync(binaryPath)) {
32
+ console.error(`❌ Binary not found: ${binaryPath}`);
33
+ console.error(` Platform: ${platform}-${arch}`);
34
+ process.exit(1);
35
+ }
36
+
37
+ return binaryPath;
38
+ }
39
+
40
+ // Main CLI handler
41
+ function main() {
42
+ const args = process.argv.slice(2);
43
+
44
+ // Handle special commands
45
+ if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
46
+ showHelp();
47
+ return;
48
+ }
49
+
50
+ if (args[0] === 'version' || args[0] === '--version') {
51
+ console.log('ReePoe Plugin v1.0.0');
52
+ return;
53
+ }
54
+
55
+ if (args[0] === 'query') {
56
+ // Direct query command
57
+ const query = args.slice(1).join(' ');
58
+ makeQuery(query);
59
+ return;
60
+ }
61
+
62
+ // For other commands, pass through to binary
63
+ console.log('ℹ️ Use specific commands: reepoe-start, reepoe-stop, reepoe-status');
64
+ console.log(' Or: reepoe query "your question here"');
65
+ }
66
+
67
+ function showHelp() {
68
+ console.log(`
69
+ ╔══════════════════════════════════════════════════════════════╗
70
+ ║ ReePoe CLI - Help ║
71
+ ╚══════════════════════════════════════════════════════════════╝
72
+
73
+ COMMANDS:
74
+ reepoe-start Start ReePoe server
75
+ reepoe-stop Stop ReePoe server
76
+ reepoe-status Check ReePoe server status
77
+ reepoe query "..." Send query to ReePoe
78
+
79
+ EXAMPLES:
80
+ reepoe query "what does this codebase do?"
81
+ reepoe query "show me all API endpoints"
82
+ reepoe query "find all test files"
83
+
84
+ MANAGEMENT:
85
+ reepoe-start Start server in background
86
+ reepoe-stop Stop server
87
+ reepoe-status Check if server is running
88
+
89
+ MORE INFO:
90
+ Documentation: https://reepoe.com/docs
91
+ API: http://localhost:<port>/describe
92
+ `);
93
+ }
94
+
95
+ async function makeQuery(query) {
96
+ const axios = require('axios');
97
+ const configPath = path.join(process.cwd(), 'reepoe.config.json');
98
+
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
111
+ let userEmail = null;
112
+ const activationPath = path.join(os.homedir(), '.reepoe', 'activation.json');
113
+ if (fs.existsSync(activationPath)) {
114
+ try {
115
+ const activation = JSON.parse(fs.readFileSync(activationPath, 'utf8'));
116
+ userEmail = activation.email;
117
+ } catch (e) {
118
+ // No activation or invalid - metrics will be aggregate only
119
+ }
120
+ }
121
+
122
+ const url = `http://localhost:${port}/query`;
123
+
124
+ try {
125
+ console.log(`\n🤖 ReePoe processing: "${query}"\n`);
126
+ const requestBody = { instruction: query };
127
+ if (userEmail) {
128
+ requestBody.user_email = userEmail;
129
+ }
130
+ const response = await axios.post(url, requestBody);
131
+ console.log(response.data.response || response.data);
132
+ } catch (error) {
133
+ if (error.code === 'ECONNREFUSED') {
134
+ console.error('❌ ReePoe server not running. Start it with: reepoe-start');
135
+ } else {
136
+ console.error(`❌ Query failed: ${error.message}`);
137
+ }
138
+ process.exit(1);
139
+ }
140
+ }
141
+
142
+ main();
143
+
package/bin/start.js ADDED
@@ -0,0 +1,250 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ReePoe Start - Starts ReePoe server in background
4
+ */
5
+
6
+ const { spawn } = require('child_process');
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+ const os = require('os');
10
+ const axios = require('axios');
11
+
12
+ // Get binary path
13
+ function getBinaryPath() {
14
+ const platform = os.platform();
15
+ const arch = os.arch();
16
+
17
+ let binaryName;
18
+ if (platform === 'darwin') {
19
+ binaryName = arch === 'arm64' ? 'reepoe-macos-arm64' : 'reepoe-macos-x64';
20
+ } else if (platform === 'linux') {
21
+ binaryName = 'reepoe-linux-x64';
22
+ } else if (platform === 'win32') {
23
+ binaryName = 'reepoe-windows.exe';
24
+ }
25
+
26
+ return path.join(__dirname, '../binaries', binaryName);
27
+ }
28
+
29
+ // Check if server is already running
30
+ async function isServerRunning(port) {
31
+ try {
32
+ await axios.get(`http://localhost:${port}/health`, { timeout: 2000 });
33
+ return true;
34
+ } catch (error) {
35
+ return false;
36
+ }
37
+ }
38
+
39
+ // ========== PHASE 3B: Activation Check ==========
40
+
41
+ async function checkActivationStatus() {
42
+ const ActivationClient = require('../lib/activation-client');
43
+ const client = new ActivationClient();
44
+ const readline = require('readline');
45
+
46
+ // Check for existing activation
47
+ const activation = client.loadActivation();
48
+
49
+ if (activation) {
50
+ // Verify activation is still valid via API
51
+ const check = await client.checkActivation(activation.email, require('../package.json').version);
52
+
53
+ if (check.activated) {
54
+ // Show expiry warning if needed
55
+ if (check.warn_expiring) {
56
+ console.log(`\n⚠️ Your access expires in ${check.days_remaining} days!`);
57
+ console.log(' Request extension: reepoe extend-request\n');
58
+ }
59
+
60
+ // Check version
61
+ if (check.update_required && check.critical_update) {
62
+ console.log('\n🚨 CRITICAL SECURITY UPDATE REQUIRED');
63
+ console.log(` Your version: ${require('../package.json').version}`);
64
+ console.log(` Minimum version: ${check.latest_version}`);
65
+ console.log(' Update: npm install -g reepoe@latest\n');
66
+ process.exit(1);
67
+ } else if (check.update_required) {
68
+ console.log(`\nℹ️ Update available: ${check.latest_version}`);
69
+ console.log(` You're on: ${require('../package.json').version}`);
70
+ console.log(' Update: npm install -g reepoe@latest\n');
71
+ // Continue (non-blocking)
72
+ }
73
+
74
+ return activation.email;
75
+ }
76
+ }
77
+
78
+ // No valid activation - show activation prompt
79
+ console.log('\n╔═══════════════════════════════════════════════════════════════╗');
80
+ console.log('║ 🤖 ReePoe - Activation Required ║');
81
+ console.log('╚═══════════════════════════════════════════════════════════════╝\n');
82
+
83
+ const rl = readline.createInterface({
84
+ input: process.stdin,
85
+ output: process.stdout
86
+ });
87
+
88
+ // Prompt for email
89
+ const email = await new Promise((resolve) => {
90
+ rl.question('📧 Enter your email: ', (answer) => {
91
+ resolve(answer.trim());
92
+ });
93
+ });
94
+
95
+ if (!email) {
96
+ console.log('\n❌ Email required for activation');
97
+ process.exit(1);
98
+ }
99
+
100
+ // Prompt for code
101
+ const code = await new Promise((resolve) => {
102
+ rl.question('🔑 Enter activation code (or press Enter to join waitlist): ', (answer) => {
103
+ rl.close();
104
+ resolve(answer.trim());
105
+ });
106
+ });
107
+
108
+ if (code) {
109
+ // Redeem code
110
+ console.log('\n⏳ Validating activation code...');
111
+ const result = await client.redeemCode(email, code, require('../package.json').version);
112
+
113
+ if (result.success) {
114
+ console.log('\n╔═══════════════════════════════════════════════════════════════╗');
115
+ console.log('║ ✅ Activation Successful! ║');
116
+ console.log('╚═══════════════════════════════════════════════════════════════╝\n');
117
+ console.log(`Welcome to ReePoe, ${email}!`);
118
+ console.log(`\n📊 Your Account:`);
119
+ console.log(` Status: Active`);
120
+ console.log(` Expires: ${new Date(result.user.expires_at).toLocaleDateString()} (30 days)`);
121
+ console.log(` Type: Alpha tester\n`);
122
+ console.log('💡 Quick Start:');
123
+ console.log(' reepoe query "show me all API endpoints"');
124
+ console.log(' reepoe metrics - View your stats\n');
125
+
126
+ return email;
127
+ } else {
128
+ console.log(`\n❌ Activation failed: ${result.message}`);
129
+ if (result.details) {
130
+ console.log(` ${result.details}`);
131
+ }
132
+ console.log('\n💡 Try joining the waitlist (press Enter when prompted for code)\n');
133
+ process.exit(1);
134
+ }
135
+ } else {
136
+ // Join waitlist
137
+ console.log('\n⏳ Joining waitlist...');
138
+ const result = await client.joinWaitlist(email);
139
+
140
+ if (result.success) {
141
+ console.log('\n╔═══════════════════════════════════════════════════════════════╗');
142
+ console.log('║ ⏰ Joined Waitlist! ║');
143
+ console.log('╚═══════════════════════════════════════════════════════════════╝\n');
144
+ console.log(`Welcome to the ReePoe waitlist!`);
145
+ console.log(`\n📍 Your Position: #${result.position}`);
146
+ console.log(`📅 Next Code Drop: ${result.next_drop || 'TBD'}`);
147
+ console.log(`\n💡 What Happens Next:`);
148
+ console.log(' - We\'ll email you when a code is available');
149
+ console.log(' - Codes are sent in batches weekly');
150
+ console.log(' - First-come, first-served\n');
151
+ console.log(`❌ ReePoe requires activation to start.`);
152
+ console.log(' You\'ll be notified when your code is ready!\n');
153
+ } else {
154
+ console.log(`\n❌ Failed to join waitlist: ${result.message}\n`);
155
+ }
156
+
157
+ process.exit(1);
158
+ }
159
+ }
160
+
161
+ // Main function
162
+ async function main() {
163
+ // Check activation first (Phase 3B)
164
+ const email = await checkActivationStatus();
165
+
166
+ console.log('\n🚀 Starting ReePoe server...\n');
167
+
168
+ // Read configuration
169
+ const configPath = path.join(process.cwd(), 'reepoe.config.json');
170
+ let port = 8000;
171
+
172
+ if (fs.existsSync(configPath)) {
173
+ try {
174
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
175
+ port = config.api?.port || 8000;
176
+ console.log(`📋 Configuration found: ${configPath}`);
177
+ } catch (e) {
178
+ console.log('⚠️ Using default configuration');
179
+ }
180
+ } else {
181
+ console.log('ℹ️ No configuration found, using defaults');
182
+ }
183
+
184
+ // Check if already running
185
+ const running = await isServerRunning(port);
186
+ if (running) {
187
+ console.log(`\n✅ ReePoe is already running on port ${port}`);
188
+ console.log(` API: http://localhost:${port}`);
189
+ console.log(` Dashboard: http://localhost:${port}/dashboard`);
190
+ return;
191
+ }
192
+
193
+ // Get binary path
194
+ const binaryPath = getBinaryPath();
195
+
196
+ if (!fs.existsSync(binaryPath)) {
197
+ console.error(`❌ ReePoe binary not found: ${binaryPath}`);
198
+ console.error(' Try reinstalling: npm install -g @reepoe/plugin');
199
+ process.exit(1);
200
+ }
201
+
202
+ // Start server
203
+ console.log(`🔧 Starting server on port ${port}...`);
204
+
205
+ const env = {
206
+ ...process.env,
207
+ PORT: port.toString(),
208
+ HOST: '127.0.0.1',
209
+ PYTHONUNBUFFERED: '1'
210
+ };
211
+
212
+ const child = spawn(binaryPath, [], {
213
+ env,
214
+ detached: true,
215
+ stdio: 'ignore',
216
+ cwd: process.cwd()
217
+ });
218
+
219
+ child.unref();
220
+
221
+ // Store PID
222
+ const pidFile = path.join(os.tmpdir(), `reepoe-${port}.pid`);
223
+ fs.writeFileSync(pidFile, child.pid.toString());
224
+
225
+ // Wait a bit and check if server started
226
+ await new Promise(resolve => setTimeout(resolve, 2000));
227
+
228
+ const started = await isServerRunning(port);
229
+
230
+ if (started) {
231
+ console.log(`\n✅ ReePoe server started successfully!`);
232
+ console.log(`\n📡 Endpoints:`);
233
+ console.log(` API: http://localhost:${port}`);
234
+ console.log(` Health: http://localhost:${port}/health`);
235
+ console.log(` Metrics: http://localhost:${port}/metrics`);
236
+ console.log(` Describe: http://localhost:${port}/describe`);
237
+ console.log(`\n💡 Try: reepoe query "what does this codebase do?"`);
238
+ console.log(` Stop: reepoe-stop\n`);
239
+ } else {
240
+ console.error(`\n❌ Server failed to start on port ${port}`);
241
+ console.error(' Check logs: reepoe-status');
242
+ process.exit(1);
243
+ }
244
+ }
245
+
246
+ main().catch(error => {
247
+ console.error(`❌ Error: ${error.message}`);
248
+ process.exit(1);
249
+ });
250
+
package/bin/status.js ADDED
@@ -0,0 +1,84 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ReePoe Status - Check ReePoe server status
4
+ */
5
+
6
+ const axios = require('axios');
7
+ const path = require('path');
8
+ const fs = require('fs');
9
+ const os = require('os');
10
+
11
+ async function checkServerHealth(port) {
12
+ try {
13
+ const response = await axios.get(`http://localhost:${port}/health`, { timeout: 2000 });
14
+ return { running: true, healthy: true, data: response.data };
15
+ } catch (error) {
16
+ if (error.code === 'ECONNREFUSED') {
17
+ return { running: false, healthy: false };
18
+ }
19
+ return { running: true, healthy: false, error: error.message };
20
+ }
21
+ }
22
+
23
+ async function main() {
24
+ console.log('\n📊 ReePoe Server Status\n');
25
+
26
+ // Read configuration
27
+ const configPath = path.join(process.cwd(), 'reepoe.config.json');
28
+ let port = 8000;
29
+ let projectName = 'unknown';
30
+
31
+ if (fs.existsSync(configPath)) {
32
+ try {
33
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
34
+ port = config.api?.port || 8000;
35
+ projectName = config.project?.name || path.basename(process.cwd());
36
+ console.log(`📁 Project: ${projectName}`);
37
+ console.log(`🔧 Configuration: ${configPath}`);
38
+ } catch (e) {
39
+ console.log('⚠️ Configuration file exists but couldn\'t be read');
40
+ }
41
+ } else {
42
+ console.log('ℹ️ No configuration file found');
43
+ }
44
+
45
+ console.log(`🌐 Expected port: ${port}`);
46
+
47
+ // Check PID file
48
+ const pidFile = path.join(os.tmpdir(), `reepoe-${port}.pid`);
49
+ let pid = null;
50
+
51
+ if (fs.existsSync(pidFile)) {
52
+ pid = parseInt(fs.readFileSync(pidFile, 'utf8'));
53
+ console.log(`📝 PID file found: ${pid}`);
54
+ } else {
55
+ console.log(`📝 No PID file found`);
56
+ }
57
+
58
+ // Check server health
59
+ console.log(`\n🏥 Health check: http://localhost:${port}/health`);
60
+ const health = await checkServerHealth(port);
61
+
62
+ if (health.running && health.healthy) {
63
+ console.log(`✅ Server is RUNNING and HEALTHY`);
64
+ console.log(`\n📡 Available endpoints:`);
65
+ console.log(` - GET http://localhost:${port}/describe`);
66
+ console.log(` - POST http://localhost:${port}/query`);
67
+ console.log(` - GET http://localhost:${port}/metrics`);
68
+ console.log(`\n💡 Try: reepoe query "what does this codebase do?"`);
69
+ } else if (health.running && !health.healthy) {
70
+ console.log(`⚠️ Server is running but unhealthy`);
71
+ console.log(` Error: ${health.error}`);
72
+ } else {
73
+ console.log(`❌ Server is NOT RUNNING`);
74
+ console.log(`\n💡 Start it with: reepoe-start`);
75
+ }
76
+
77
+ console.log('');
78
+ }
79
+
80
+ main().catch(error => {
81
+ console.error(`❌ Status check failed: ${error.message}`);
82
+ process.exit(1);
83
+ });
84
+
package/bin/stop.js ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * ReePoe Stop - Stops ReePoe server
4
+ */
5
+
6
+ const path = require('path');
7
+ const fs = require('fs');
8
+ const os = require('os');
9
+
10
+ function main() {
11
+ console.log('\n🛑 Stopping ReePoe server...\n');
12
+
13
+ // Read configuration to get port
14
+ const configPath = path.join(process.cwd(), 'reepoe.config.json');
15
+ let port = 8000;
16
+
17
+ if (fs.existsSync(configPath)) {
18
+ try {
19
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
20
+ port = config.api?.port || 8000;
21
+ } catch (e) {
22
+ // Use default
23
+ }
24
+ }
25
+
26
+ // Find PID file
27
+ const pidFile = path.join(os.tmpdir(), `reepoe-${port}.pid`);
28
+
29
+ if (!fs.existsSync(pidFile)) {
30
+ console.log('ℹ️ ReePoe server doesn\'t appear to be running (no PID file found)');
31
+ return;
32
+ }
33
+
34
+ // Read PID
35
+ const pid = parseInt(fs.readFileSync(pidFile, 'utf8'));
36
+
37
+ // Kill process
38
+ try {
39
+ process.kill(pid, 'SIGTERM');
40
+ fs.unlinkSync(pidFile);
41
+ console.log(`✅ ReePoe server stopped (PID: ${pid})`);
42
+ console.log(` Port ${port} is now available\n`);
43
+ } catch (error) {
44
+ if (error.code === 'ESRCH') {
45
+ console.log('ℹ️ Process not found (may have already stopped)');
46
+ fs.unlinkSync(pidFile);
47
+ } else {
48
+ console.error(`❌ Failed to stop server: ${error.message}`);
49
+ process.exit(1);
50
+ }
51
+ }
52
+ }
53
+
54
+ main();
55
+
Binary file
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "reepoe",
3
+ "version": "1.1.1",
4
+ "description": "ReePoe AI Code Manager - Install in any codebase for instant AI agent integration",
5
+ "keywords": [
6
+ "ai",
7
+ "code-manager",
8
+ "context-optimization",
9
+ "plugin",
10
+ "developer-tools",
11
+ "ai-agent",
12
+ "mcp",
13
+ "code-analysis",
14
+ "llm-optimization"
15
+ ],
16
+ "author": "ReePoe Team",
17
+ "license": "Proprietary",
18
+ "homepage": "https://reepoe.com",
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/MarcAndre72/ReePoe"
22
+ },
23
+ "bin": {
24
+ "reepoe": "./bin/reepoe.js",
25
+ "reepoe-start": "./bin/start.js",
26
+ "reepoe-stop": "./bin/stop.js",
27
+ "reepoe-status": "./bin/status.js",
28
+ "reepoe-metrics": "./bin/metrics.js",
29
+ "reepoe-admin": "./bin/admin.js",
30
+ "reepoe-extend-request": "./bin/extend-request.js"
31
+ },
32
+ "scripts": {
33
+ "postinstall": "node scripts/setup.js"
34
+ },
35
+ "engines": {
36
+ "node": ">=16.0.0"
37
+ },
38
+ "os": [
39
+ "darwin",
40
+ "linux",
41
+ "win32"
42
+ ],
43
+ "cpu": [
44
+ "x64",
45
+ "arm64"
46
+ ],
47
+ "dependencies": {
48
+ "axios": "^1.6.0",
49
+ "find-free-port": "^2.0.0",
50
+ "ps-node": "^0.1.6"
51
+ },
52
+ "files": [
53
+ "bin",
54
+ "scripts",
55
+ "binaries",
56
+ "README.md"
57
+ ]
58
+ }