@orion-js/core 3.11.9 → 3.11.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.
|
@@ -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 = 'v1';
|
|
6
|
+
exports.VERSION_FILE = 'version.txt';
|
|
@@ -0,0 +1,50 @@
|
|
|
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(colors.green(`MCP documentation already installed in .orion/mcp (version ${MCP_VERSION})`))
|
|
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.yellow(`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 v${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.green(`Successfully downloaded MCP documentation v${consts_1.MCP_VERSION} to .orion/mcp`));
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
console.error(safe_1.default.red('Error copying MCP documentation:'), error);
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
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 = ['README.md', 'docs', '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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/core",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.10",
|
|
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": "231fd9e0f484cc902d4e0cd7058cc6ce6479ddca",
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@shelf/jest-mongodb": "^2.1.0",
|
|
42
42
|
"@types/prompts": "^2.4.2",
|