ropilot 0.1.8 → 0.1.11
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/setup.js +17 -34
- 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/setup.js
CHANGED
|
@@ -222,38 +222,18 @@ async function installPlugin() {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
/**
|
|
225
|
-
*
|
|
225
|
+
* Install ropilot globally so it's available as a command
|
|
226
226
|
*/
|
|
227
|
-
function
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
const mcpPath = '.mcp.json';
|
|
238
|
-
|
|
239
|
-
if (existsSync(mcpPath)) {
|
|
240
|
-
// Merge with existing config
|
|
241
|
-
try {
|
|
242
|
-
const existing = JSON.parse(readFileSync(mcpPath, 'utf-8'));
|
|
243
|
-
if (!existing.mcpServers?.ropilot) {
|
|
244
|
-
existing.mcpServers = existing.mcpServers || {};
|
|
245
|
-
existing.mcpServers.ropilot = mcpConfig.mcpServers.ropilot;
|
|
246
|
-
writeFileSync(mcpPath, JSON.stringify(existing, null, 2));
|
|
247
|
-
console.log(` Updated: ${mcpPath} (added ropilot server)`);
|
|
248
|
-
} else {
|
|
249
|
-
console.log(` Exists: ${mcpPath} (ropilot already configured)`);
|
|
250
|
-
}
|
|
251
|
-
} catch (err) {
|
|
252
|
-
console.error(` Failed to update ${mcpPath}: ${err.message}`);
|
|
253
|
-
}
|
|
254
|
-
} else {
|
|
255
|
-
writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2));
|
|
256
|
-
console.log(` Created: ${mcpPath}`);
|
|
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;
|
|
257
237
|
}
|
|
258
238
|
}
|
|
259
239
|
|
|
@@ -427,8 +407,12 @@ export async function init(providedApiKey = null) {
|
|
|
427
407
|
console.log('');
|
|
428
408
|
}
|
|
429
409
|
|
|
430
|
-
// Install
|
|
410
|
+
// Install ropilot globally
|
|
431
411
|
console.log('');
|
|
412
|
+
const globalInstallOk = installGlobally();
|
|
413
|
+
console.log('');
|
|
414
|
+
|
|
415
|
+
// Install Studio plugin
|
|
432
416
|
await installPlugin();
|
|
433
417
|
console.log('');
|
|
434
418
|
|
|
@@ -436,10 +420,9 @@ export async function init(providedApiKey = null) {
|
|
|
436
420
|
const pkg = await downloadPrompts(apiKey);
|
|
437
421
|
console.log('');
|
|
438
422
|
|
|
439
|
-
// Set up project files
|
|
423
|
+
// Set up project files (includes .mcp.json from package)
|
|
440
424
|
console.log('Setting up project files...');
|
|
441
425
|
setupProjectPrompts(pkg);
|
|
442
|
-
createMcpConfig();
|
|
443
426
|
console.log('');
|
|
444
427
|
|
|
445
428
|
// Done!
|