@olonjs/cli 3.0.116 → 3.0.119
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/assets/src_tenant_alpha.sh +115 -178
- package/assets/templates/agritourism/src_tenant.sh +2 -2
- package/assets/templates/alpha/src_tenant.sh +115 -178
- package/package.json +1 -1
- package/src/index.js +70 -0
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import path from 'path';
|
|
|
6
6
|
import { execa } from 'execa';
|
|
7
7
|
import ora from 'ora';
|
|
8
8
|
import { fileURLToPath } from 'url';
|
|
9
|
+
import os from 'os';
|
|
9
10
|
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = path.dirname(__filename);
|
|
@@ -228,4 +229,73 @@ async function injectInfraFiles(targetDir, name) {
|
|
|
228
229
|
await fs.writeJson(path.join(targetDir, 'components.json'), shadcnConfig, { spaces: 2 });
|
|
229
230
|
}
|
|
230
231
|
|
|
232
|
+
program
|
|
233
|
+
.command('init-mcp')
|
|
234
|
+
.description('Automatically configure Cursor MCP settings for OlonJS')
|
|
235
|
+
.action(async () => {
|
|
236
|
+
console.log(chalk.blue.bold('\nInitializing OlonJS MCP for Cursor...\n'));
|
|
237
|
+
|
|
238
|
+
const isWin = process.platform === 'win32';
|
|
239
|
+
const commandName = isWin ? 'npx.cmd' : 'npx';
|
|
240
|
+
|
|
241
|
+
const mcpConfig = {
|
|
242
|
+
command: commandName,
|
|
243
|
+
args: ['-y', '@olonjs/mcp@latest', 'http://localhost:5174']
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
const homeDir = os.homedir();
|
|
247
|
+
const pathsToCheck = [
|
|
248
|
+
path.join(homeDir, '.cursor', 'mcp.json'),
|
|
249
|
+
];
|
|
250
|
+
|
|
251
|
+
if (isWin) {
|
|
252
|
+
pathsToCheck.push(path.join(homeDir, 'AppData', 'Roaming', 'Cursor', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'));
|
|
253
|
+
} else if (process.platform === 'darwin') {
|
|
254
|
+
pathsToCheck.push(path.join(homeDir, 'Library', 'Application Support', 'Cursor', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'));
|
|
255
|
+
} else {
|
|
256
|
+
pathsToCheck.push(path.join(homeDir, '.config', 'Cursor', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json'));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let updatedCount = 0;
|
|
260
|
+
|
|
261
|
+
for (const configPath of pathsToCheck) {
|
|
262
|
+
try {
|
|
263
|
+
let configData = { mcpServers: {} };
|
|
264
|
+
|
|
265
|
+
if (fs.existsSync(configPath)) {
|
|
266
|
+
const content = await fs.readFile(configPath, 'utf-8');
|
|
267
|
+
try {
|
|
268
|
+
configData = JSON.parse(content);
|
|
269
|
+
} catch (e) {
|
|
270
|
+
console.log(chalk.yellow(`Warning: Could not parse ${configPath}. Creating new object.`));
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
// If the file doesn't exist, we ensure the directory exists first
|
|
274
|
+
await fs.ensureDir(path.dirname(configPath));
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (!configData.mcpServers) {
|
|
278
|
+
configData.mcpServers = {};
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
configData.mcpServers['OlonJS'] = mcpConfig;
|
|
282
|
+
|
|
283
|
+
await fs.writeFile(configPath, JSON.stringify(configData, null, 2));
|
|
284
|
+
console.log(chalk.green(`✓ Updated MCP configuration at: ${configPath}`));
|
|
285
|
+
updatedCount++;
|
|
286
|
+
} catch (err) {
|
|
287
|
+
console.log(chalk.gray(`Skipped ${configPath} (not found or accessible)`));
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
if (updatedCount === 0) {
|
|
292
|
+
console.log(chalk.red('\nCould not find any Cursor MCP configuration files to update.'));
|
|
293
|
+
console.log('You can manually add the following JSON to your MCP settings:');
|
|
294
|
+
console.log(JSON.stringify({ "OlonJS": mcpConfig }, null, 2));
|
|
295
|
+
} else {
|
|
296
|
+
console.log(chalk.green.bold('\nOlonJS MCP configured successfully!'));
|
|
297
|
+
console.log(chalk.cyan('Please restart Cursor (or run "Developer: Reload Window") to apply the changes.'));
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
231
301
|
program.parse();
|