@orion-js/core 3.11.9 → 3.11.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.
|
@@ -39,10 +39,10 @@ async function copyCursorRule() {
|
|
|
39
39
|
const content = await downloadFile(sourceUrl);
|
|
40
40
|
// Write the content to the target file
|
|
41
41
|
await promises_1.default.writeFile(targetFile, content, 'utf8');
|
|
42
|
-
console.log(safe_1.default.bold(
|
|
42
|
+
console.log(safe_1.default.bold(`=> ✨ Updated cursor rules to the latest versions`));
|
|
43
43
|
}
|
|
44
44
|
catch (error) {
|
|
45
|
-
console.error('Error copying cursor
|
|
45
|
+
console.error('=> ✨ Error copying cursor rules:', error);
|
|
46
46
|
throw error;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VERSION_FILE = exports.MCP_VERSION = void 0;
|
|
4
|
+
// Define current MCP version - update this when a new version needs to be deployed
|
|
5
|
+
exports.MCP_VERSION = 'v2';
|
|
6
|
+
exports.VERSION_FILE = 'version.txt';
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.copyMCP = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
9
|
+
const execute_1 = __importDefault(require("../../helpers/execute"));
|
|
10
|
+
const safe_1 = __importDefault(require("colors/safe"));
|
|
11
|
+
const isValidMCPRepo_1 = require("./isValidMCPRepo");
|
|
12
|
+
const consts_1 = require("./consts");
|
|
13
|
+
async function copyMCP() {
|
|
14
|
+
const repoUrl = 'https://github.com/orionjs/mcp-docs';
|
|
15
|
+
const targetDir = path_1.default.join(process.cwd(), '.orion', 'mcp');
|
|
16
|
+
try {
|
|
17
|
+
// Ensure parent directory exists
|
|
18
|
+
await promises_1.default.mkdir(path_1.default.join(process.cwd(), '.orion'), { recursive: true });
|
|
19
|
+
// Check if the repository is already properly installed with current version
|
|
20
|
+
if (await (0, isValidMCPRepo_1.isValidMCPRepository)(targetDir)) {
|
|
21
|
+
console.log(safe_1.default.bold(`=> ✨ MCP documentation already installed`));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Check if the directory already exists but is not a valid repository or has outdated version
|
|
25
|
+
try {
|
|
26
|
+
const stats = await promises_1.default.stat(targetDir);
|
|
27
|
+
if (stats.isDirectory()) {
|
|
28
|
+
// Directory exists, remove it first to ensure fresh clone
|
|
29
|
+
await promises_1.default.rm(targetDir, { recursive: true, force: true });
|
|
30
|
+
console.log(safe_1.default.bold(`=> ✨ Removed existing .orion/mcp directory (invalid, incomplete, or outdated)`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
// Directory doesn't exist, which is fine
|
|
35
|
+
}
|
|
36
|
+
// Clone the repository
|
|
37
|
+
console.log(safe_1.default.bold(`=> ✨ Downloading MCP documentation ${consts_1.MCP_VERSION}...`));
|
|
38
|
+
await (0, execute_1.default)(`git clone ${repoUrl} ${targetDir}`);
|
|
39
|
+
// Remove git directory to avoid confusion
|
|
40
|
+
await (0, execute_1.default)(`rm -rf ${path_1.default.join(targetDir, '.git')}`);
|
|
41
|
+
// Create version file
|
|
42
|
+
await promises_1.default.writeFile(path_1.default.join(targetDir, consts_1.VERSION_FILE), consts_1.MCP_VERSION, 'utf-8');
|
|
43
|
+
console.log(safe_1.default.bold(`=> ✨ Successfully downloaded MCP documentation v${consts_1.MCP_VERSION} to .orion/mcp`));
|
|
44
|
+
const mcpServerConfig = {
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"orionjs": {
|
|
47
|
+
"command": "node",
|
|
48
|
+
"args": [
|
|
49
|
+
path_1.default.join(targetDir, 'src', 'index.js')
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
const configPath = path_1.default.join(process.cwd(), '.cursor', 'mcp.json');
|
|
55
|
+
// Check if the config file exists
|
|
56
|
+
try {
|
|
57
|
+
// Try to read existing config file
|
|
58
|
+
const existingConfig = await promises_1.default.readFile(configPath, 'utf-8');
|
|
59
|
+
const parsedConfig = JSON.parse(existingConfig);
|
|
60
|
+
// Update the mcpServers section while preserving other settings
|
|
61
|
+
parsedConfig.mcpServers = {
|
|
62
|
+
...parsedConfig.mcpServers,
|
|
63
|
+
...mcpServerConfig.mcpServers
|
|
64
|
+
};
|
|
65
|
+
// Write the updated config back
|
|
66
|
+
await promises_1.default.writeFile(configPath, JSON.stringify(parsedConfig, null, 2), 'utf-8');
|
|
67
|
+
console.log(safe_1.default.bold(`=> ✨ Updated MCP server configuration in .cursor/mcp.json`));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
// If file doesn't exist or can't be parsed, create a new one
|
|
71
|
+
// Ensure the .cursor directory exists
|
|
72
|
+
await promises_1.default.mkdir(path_1.default.dirname(configPath), { recursive: true });
|
|
73
|
+
// Write the new config file
|
|
74
|
+
await promises_1.default.writeFile(configPath, JSON.stringify(mcpServerConfig, null, 2), 'utf-8');
|
|
75
|
+
console.log(safe_1.default.bold(`=> ✨ Created new MCP server configuration in .cursor/mcp.json`));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
console.error(safe_1.default.red('=> ✨ Error copying MCP documentation:'), error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
exports.copyMCP = copyMCP;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isValidMCPRepository = void 0;
|
|
7
|
+
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const safe_1 = __importDefault(require("colors/safe"));
|
|
10
|
+
const consts_1 = require("./consts");
|
|
11
|
+
/**
|
|
12
|
+
* Checks if the MCP repository appears to be already installed correctly
|
|
13
|
+
* and has the current version
|
|
14
|
+
*/
|
|
15
|
+
async function isValidMCPRepository(directoryPath) {
|
|
16
|
+
try {
|
|
17
|
+
// Check if directory exists
|
|
18
|
+
const stats = await promises_1.default.stat(directoryPath);
|
|
19
|
+
if (!stats.isDirectory())
|
|
20
|
+
return false;
|
|
21
|
+
// Check for some key files/directories that should exist in the repository
|
|
22
|
+
// This helps verify it's a valid repository and not just an empty or corrupted directory
|
|
23
|
+
const expectedFiles = ['settings.js', 'package.json'];
|
|
24
|
+
for (const file of expectedFiles) {
|
|
25
|
+
try {
|
|
26
|
+
await promises_1.default.access(path_1.default.join(directoryPath, file));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// If any expected file doesn't exist, consider the repository invalid
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
// Check if version file exists and has the correct version
|
|
34
|
+
try {
|
|
35
|
+
const versionPath = path_1.default.join(directoryPath, consts_1.VERSION_FILE);
|
|
36
|
+
const versionContent = await promises_1.default.readFile(versionPath, 'utf-8');
|
|
37
|
+
// If the version in the file doesn't match the current version,
|
|
38
|
+
// consider the repository outdated
|
|
39
|
+
if (versionContent.trim() !== consts_1.MCP_VERSION) {
|
|
40
|
+
console.log(safe_1.default.yellow(`=> ✨ MCP version mismatch: installed=${versionContent.trim()}, required=${consts_1.MCP_VERSION}`));
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Version file doesn't exist or can't be read
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
// All checks passed, consider it a valid and current repository
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Any error means directory doesn't exist or can't be accessed
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
exports.isValidMCPRepository = isValidMCPRepository;
|
package/lib/start/index.js
CHANGED
|
@@ -7,13 +7,17 @@ const safe_1 = __importDefault(require("colors/safe"));
|
|
|
7
7
|
const runner_1 = require("./runner");
|
|
8
8
|
const watchAndCompile_1 = __importDefault(require("./watchAndCompile"));
|
|
9
9
|
const copyCursorRule_1 = require("./copyCursorRule");
|
|
10
|
+
const copyMCP_1 = require("./copyMCP");
|
|
10
11
|
async function default_1(options) {
|
|
11
12
|
console.log(safe_1.default.bold('\nOrionjs App ' + safe_1.default.green(safe_1.default.bold('V3\n'))));
|
|
12
13
|
if (!options.omitCursorRule) {
|
|
13
|
-
(0, copyCursorRule_1.copyCursorRule)().catch(console.error);
|
|
14
|
+
await ((0, copyCursorRule_1.copyCursorRule)().catch(console.error));
|
|
14
15
|
}
|
|
15
16
|
if (!options.omitMcpServer) {
|
|
16
|
-
|
|
17
|
+
await ((0, copyMCP_1.copyMCP)().catch(console.error));
|
|
18
|
+
}
|
|
19
|
+
if (!options.omitMcpServer && !options.omitCursorRule) {
|
|
20
|
+
console.log(safe_1.default.bold(`=> ✨ Orionjs AI is ready\n`));
|
|
17
21
|
}
|
|
18
22
|
const runner = (0, runner_1.getRunner)(options);
|
|
19
23
|
(0, watchAndCompile_1.default)(runner);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/core",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.11",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"engines": {
|
|
37
37
|
"node": ">=14.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "a1524557edf2cdc5f28ce1f0b52de7ba28b86c3a",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@shelf/jest-mongodb": "^2.1.0",
|
|
42
42
|
"@types/prompts": "^2.4.2",
|