reepoe 1.1.7 ā 1.1.9
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/metrics.js +3 -3
- package/bin/reepoe.js +31 -141
- package/binaries/reepoe-linux-x64 +0 -0
- package/package.json +1 -1
package/bin/metrics.js
CHANGED
|
@@ -24,9 +24,9 @@ async function showMetrics() {
|
|
|
24
24
|
console.log('\nš Loading your ReePoe metrics...\n');
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
|
-
// Use per-user metrics endpoint
|
|
28
|
-
const
|
|
29
|
-
const res = await axios.get(`${
|
|
27
|
+
// Use per-user metrics endpoint with api_base from activation
|
|
28
|
+
const API_BASE = activation.api_base || 'https://reepoe-api.onrender.com';
|
|
29
|
+
const res = await axios.get(`${API_BASE}/api/metrics/user/${activation.email}`);
|
|
30
30
|
const data = res.data;
|
|
31
31
|
|
|
32
32
|
// Per-user endpoint returns the correct structure already
|
package/bin/reepoe.js
CHANGED
|
@@ -1,152 +1,42 @@
|
|
|
1
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');
|
|
2
|
+
const axios = require('axios');
|
|
9
3
|
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
10
5
|
const os = require('os');
|
|
11
6
|
|
|
12
|
-
|
|
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
|
-
}
|
|
7
|
+
const ACTIVATION_FILE = path.join(os.homedir(), '.reepoe', 'activation.json');
|
|
39
8
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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"');
|
|
9
|
+
function loadActivation() {
|
|
10
|
+
if (!fs.existsSync(ACTIVATION_FILE)) {
|
|
11
|
+
console.error('ā Not activated. Run: reepoe-start');
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
return JSON.parse(fs.readFileSync(ACTIVATION_FILE, 'utf8'));
|
|
65
15
|
}
|
|
66
16
|
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
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
|
-
`);
|
|
17
|
+
async function query(instruction) {
|
|
18
|
+
const activation = loadActivation();
|
|
19
|
+
const API_BASE = activation.api_base || 'http://localhost:8000';
|
|
20
|
+
|
|
21
|
+
console.log(`š¤ ReePoe processing: "${instruction}"`);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const response = await axios.post(`${API_BASE}/query`, {
|
|
25
|
+
instruction,
|
|
26
|
+
user_email: activation.email
|
|
27
|
+
}, { timeout: 60000 });
|
|
28
|
+
|
|
29
|
+
console.log(response.data.response || JSON.stringify(response.data, null, 2));
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('ā Query failed:', error.response?.data?.detail || error.message);
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
93
34
|
}
|
|
94
35
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
let userEmail = null;
|
|
100
|
-
let apiBase = null;
|
|
101
|
-
const activationPath = path.join(os.homedir(), '.reepoe', 'activation.json');
|
|
102
|
-
|
|
103
|
-
if (fs.existsSync(activationPath)) {
|
|
104
|
-
try {
|
|
105
|
-
const activation = JSON.parse(fs.readFileSync(activationPath, 'utf8'));
|
|
106
|
-
userEmail = activation.email;
|
|
107
|
-
apiBase = activation.api_base;
|
|
108
|
-
} catch (e) {
|
|
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
|
-
}
|
|
125
|
-
}
|
|
126
|
-
apiBase = `http://localhost:${port}`;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const url = `${apiBase}/query`;
|
|
130
|
-
|
|
131
|
-
try {
|
|
132
|
-
console.log(`\nš¤ ReePoe processing: "${query}"\n`);
|
|
133
|
-
const requestBody = { instruction: query };
|
|
134
|
-
if (userEmail) {
|
|
135
|
-
requestBody.user_email = userEmail;
|
|
136
|
-
}
|
|
137
|
-
const response = await axios.post(url, requestBody, { timeout: 60000 });
|
|
138
|
-
console.log(response.data.response || response.data);
|
|
139
|
-
} catch (error) {
|
|
140
|
-
if (error.code === 'ECONNREFUSED') {
|
|
141
|
-
console.error('ā Cannot connect to ReePoe API');
|
|
142
|
-
console.error(` Tried: ${apiBase}`);
|
|
143
|
-
console.error(' Run: reepoe-start');
|
|
144
|
-
} else {
|
|
145
|
-
console.error(`ā Query failed: ${error.message}`);
|
|
146
|
-
}
|
|
147
|
-
process.exit(1);
|
|
148
|
-
}
|
|
36
|
+
const args = process.argv.slice(2);
|
|
37
|
+
if (args.length === 0) {
|
|
38
|
+
console.log('Usage: reepoe query "your question"');
|
|
39
|
+
process.exit(1);
|
|
149
40
|
}
|
|
150
41
|
|
|
151
|
-
|
|
152
|
-
|
|
42
|
+
query(args.join(' '));
|
|
Binary file
|