ropilot 0.1.24 → 0.1.26
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/lib/config.js +3 -0
- package/lib/proxy.js +31 -0
- package/package.json +1 -1
package/lib/config.js
CHANGED
|
@@ -84,6 +84,9 @@ export function saveProjectConfig(config) {
|
|
|
84
84
|
export function setProjectApiKey(apiKey) {
|
|
85
85
|
const config = loadProjectConfig() || {};
|
|
86
86
|
config.apiKey = apiKey;
|
|
87
|
+
if (config.autoUpdate === undefined) {
|
|
88
|
+
config.autoUpdate = true; // Default to true, user can set to false to disable
|
|
89
|
+
}
|
|
87
90
|
saveProjectConfig(config);
|
|
88
91
|
}
|
|
89
92
|
|
package/lib/proxy.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'fs';
|
|
9
9
|
import { join } from 'path';
|
|
10
10
|
import { homedir } from 'os';
|
|
11
|
+
import { spawn } from 'child_process';
|
|
11
12
|
import { getApiKey, EDGE_URL, loadGlobalConfig, saveGlobalConfig } from './config.js';
|
|
12
13
|
|
|
13
14
|
// Plugin version check URL (served from ropilot.ai main server)
|
|
@@ -111,6 +112,33 @@ async function processRequest(apiKey, request) {
|
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Run update in background (non-blocking)
|
|
117
|
+
* Claude/Cursor spawn MCP servers from the project root, so process.cwd() is correct
|
|
118
|
+
*/
|
|
119
|
+
function runBackgroundUpdate() {
|
|
120
|
+
try {
|
|
121
|
+
// Check if auto-update is disabled in .ropilot.json
|
|
122
|
+
const configPath = join(process.cwd(), '.ropilot.json');
|
|
123
|
+
if (existsSync(configPath)) {
|
|
124
|
+
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
125
|
+
if (config.autoUpdate === false) {
|
|
126
|
+
return; // User disabled auto-update
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const child = spawn('npx', ['ropilot', 'update'], {
|
|
131
|
+
cwd: process.cwd(),
|
|
132
|
+
detached: true,
|
|
133
|
+
stdio: 'ignore',
|
|
134
|
+
shell: true
|
|
135
|
+
});
|
|
136
|
+
child.unref();
|
|
137
|
+
} catch (err) {
|
|
138
|
+
// Silently ignore - update is not critical
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
114
142
|
/**
|
|
115
143
|
* Check for plugin updates (runs in background, writes to stderr)
|
|
116
144
|
*/
|
|
@@ -161,6 +189,9 @@ export async function serve() {
|
|
|
161
189
|
process.exit(1);
|
|
162
190
|
}
|
|
163
191
|
|
|
192
|
+
// Run update in background (non-blocking) - keeps prompts fresh
|
|
193
|
+
runBackgroundUpdate();
|
|
194
|
+
|
|
164
195
|
// Check for plugin updates in background (non-blocking)
|
|
165
196
|
checkPluginUpdate();
|
|
166
197
|
|