ropilot 0.1.7 → 0.1.10
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/ropilot.js +54 -17
- package/lib/proxy.js +1 -1
- package/lib/setup.js +28 -5
- package/package.json +1 -1
package/bin/ropilot.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Ropilot CLI
|
|
5
5
|
*
|
|
6
6
|
* Commands:
|
|
7
|
-
* ropilot
|
|
8
|
-
* ropilot
|
|
7
|
+
* ropilot - Show help
|
|
8
|
+
* ropilot init [key] - Set up Ropilot in current project
|
|
9
|
+
* ropilot serve - Run as stdio MCP server (used by Claude Code)
|
|
9
10
|
* ropilot config - Show current configuration
|
|
10
11
|
* ropilot update - Update prompts and configs to latest version
|
|
11
12
|
*/
|
|
@@ -18,12 +19,55 @@ const __filename = fileURLToPath(import.meta.url);
|
|
|
18
19
|
const __dirname = dirname(__filename);
|
|
19
20
|
const libDir = join(__dirname, '..', 'lib');
|
|
20
21
|
|
|
22
|
+
// Get version from package.json
|
|
23
|
+
function getVersion() {
|
|
24
|
+
try {
|
|
25
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
26
|
+
return pkg.version;
|
|
27
|
+
} catch {
|
|
28
|
+
return 'unknown';
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function showHelp() {
|
|
33
|
+
const version = getVersion();
|
|
34
|
+
console.log('');
|
|
35
|
+
console.log(` Ropilot v${version} - AI-powered Roblox development`);
|
|
36
|
+
console.log('');
|
|
37
|
+
console.log(' Usage:');
|
|
38
|
+
console.log(' ropilot init [key] Set up Ropilot in current project');
|
|
39
|
+
console.log(' ropilot config Show current configuration');
|
|
40
|
+
console.log(' ropilot update Update prompts to latest version');
|
|
41
|
+
console.log(' ropilot serve Run MCP server (used by Claude Code)');
|
|
42
|
+
console.log('');
|
|
43
|
+
console.log(' Getting started:');
|
|
44
|
+
console.log(' 1. Get an API key at https://ropilot.ai');
|
|
45
|
+
console.log(' 2. Run: ropilot init');
|
|
46
|
+
console.log(' 3. Restart Roblox Studio and enter your API key in plugin settings');
|
|
47
|
+
console.log(' 4. Start Claude Code in your project directory');
|
|
48
|
+
console.log('');
|
|
49
|
+
}
|
|
50
|
+
|
|
21
51
|
// Parse command line args
|
|
22
52
|
const args = process.argv.slice(2);
|
|
23
|
-
const command = args[0] || '
|
|
53
|
+
const command = args[0] || 'help';
|
|
24
54
|
|
|
25
55
|
async function main() {
|
|
26
56
|
switch (command) {
|
|
57
|
+
case 'help':
|
|
58
|
+
case '--help':
|
|
59
|
+
case '-h': {
|
|
60
|
+
showHelp();
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
case 'version':
|
|
65
|
+
case '--version':
|
|
66
|
+
case '-v': {
|
|
67
|
+
console.log(getVersion());
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
|
|
27
71
|
case 'init': {
|
|
28
72
|
const { init } = await import(join(libDir, 'setup.js'));
|
|
29
73
|
const apiKey = args[1] || null;
|
|
@@ -43,24 +87,17 @@ async function main() {
|
|
|
43
87
|
break;
|
|
44
88
|
}
|
|
45
89
|
|
|
46
|
-
case 'serve':
|
|
47
|
-
default: {
|
|
48
|
-
// If first arg looks like a command but isn't recognized, show help
|
|
49
|
-
if (command && !command.startsWith('-') && !['serve', 'init', 'update', 'config'].includes(command)) {
|
|
50
|
-
console.error(`Unknown command: ${command}`);
|
|
51
|
-
console.error('');
|
|
52
|
-
console.error('Usage:');
|
|
53
|
-
console.error(' ropilot init [key] - Set up Ropilot in current project');
|
|
54
|
-
console.error(' ropilot - Run as stdio MCP server');
|
|
55
|
-
console.error(' ropilot config - Show current configuration');
|
|
56
|
-
console.error(' ropilot update - Update prompts to latest version');
|
|
57
|
-
process.exit(1);
|
|
58
|
-
}
|
|
59
|
-
|
|
90
|
+
case 'serve': {
|
|
60
91
|
const { serve } = await import(join(libDir, 'proxy.js'));
|
|
61
92
|
await serve();
|
|
62
93
|
break;
|
|
63
94
|
}
|
|
95
|
+
|
|
96
|
+
default: {
|
|
97
|
+
console.error(`Unknown command: ${command}`);
|
|
98
|
+
showHelp();
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
64
101
|
}
|
|
65
102
|
}
|
|
66
103
|
|
package/lib/proxy.js
CHANGED
|
@@ -37,7 +37,7 @@ function sendError(id, code, message) {
|
|
|
37
37
|
* Forward request to edge server
|
|
38
38
|
*/
|
|
39
39
|
async function forwardToEdge(apiKey, request) {
|
|
40
|
-
const url = `${EDGE_URL}/mcp/${apiKey}
|
|
40
|
+
const url = `${EDGE_URL}/mcp/${apiKey}`;
|
|
41
41
|
|
|
42
42
|
try {
|
|
43
43
|
const response = await fetch(url, {
|
package/lib/setup.js
CHANGED
|
@@ -221,15 +221,34 @@ async function installPlugin() {
|
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
/**
|
|
225
|
+
* Install ropilot globally so it's available as a command
|
|
226
|
+
*/
|
|
227
|
+
function installGlobally() {
|
|
228
|
+
console.log('Installing ropilot globally...');
|
|
229
|
+
try {
|
|
230
|
+
execSync('npm install -g ropilot', { encoding: 'utf-8', stdio: 'inherit' });
|
|
231
|
+
console.log(' Installed successfully!');
|
|
232
|
+
return true;
|
|
233
|
+
} catch (err) {
|
|
234
|
+
console.error(' Failed to install globally. You may need to run with sudo or fix npm permissions.');
|
|
235
|
+
console.log(' Falling back to npx...');
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
224
240
|
/**
|
|
225
241
|
* Create .mcp.json for Claude Code compatibility
|
|
226
242
|
*/
|
|
227
|
-
function createMcpConfig() {
|
|
243
|
+
function createMcpConfig(useNpx = false) {
|
|
228
244
|
const mcpConfig = {
|
|
229
245
|
mcpServers: {
|
|
230
|
-
ropilot: {
|
|
246
|
+
ropilot: useNpx ? {
|
|
231
247
|
command: "npx",
|
|
232
|
-
args: ["ropilot"]
|
|
248
|
+
args: ["ropilot", "serve"]
|
|
249
|
+
} : {
|
|
250
|
+
command: "ropilot",
|
|
251
|
+
args: ["serve"]
|
|
233
252
|
}
|
|
234
253
|
}
|
|
235
254
|
};
|
|
@@ -427,8 +446,12 @@ export async function init(providedApiKey = null) {
|
|
|
427
446
|
console.log('');
|
|
428
447
|
}
|
|
429
448
|
|
|
430
|
-
// Install
|
|
449
|
+
// Install ropilot globally
|
|
431
450
|
console.log('');
|
|
451
|
+
const globalInstallOk = installGlobally();
|
|
452
|
+
console.log('');
|
|
453
|
+
|
|
454
|
+
// Install Studio plugin
|
|
432
455
|
await installPlugin();
|
|
433
456
|
console.log('');
|
|
434
457
|
|
|
@@ -439,7 +462,7 @@ export async function init(providedApiKey = null) {
|
|
|
439
462
|
// Set up project files
|
|
440
463
|
console.log('Setting up project files...');
|
|
441
464
|
setupProjectPrompts(pkg);
|
|
442
|
-
createMcpConfig();
|
|
465
|
+
createMcpConfig(!globalInstallOk);
|
|
443
466
|
console.log('');
|
|
444
467
|
|
|
445
468
|
// Done!
|