@fernando.zavaleta/ai-platform-core 0.0.7-beta → 0.0.11-beta
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/cli.js +39 -15
- package/bin/mcp-server.js +70 -0
- package/package.json +5 -1
package/bin/cli.js
CHANGED
|
@@ -4,7 +4,8 @@ const path = require('path');
|
|
|
4
4
|
|
|
5
5
|
const profileKey = process.argv[2];
|
|
6
6
|
const PACKAGE_ROOT = path.join(__dirname, '..');
|
|
7
|
-
|
|
7
|
+
// Cambiamos la ruta para que incluya el nombre del perfil y mantenga orden
|
|
8
|
+
const TARGET_BASE_DIR = path.join(process.cwd(), '.cursor', 'ai-platform', profileKey);
|
|
8
9
|
|
|
9
10
|
const profiles = {
|
|
10
11
|
"qa": "03.1-qa",
|
|
@@ -19,27 +20,50 @@ if (!domainFolder) {
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
const domainPath = path.join(PACKAGE_ROOT, '03-domains', domainFolder);
|
|
22
|
-
const
|
|
23
|
+
const profileConfigPath = path.join(domainPath, 'profile.json');
|
|
23
24
|
|
|
24
|
-
if (!fs.existsSync(
|
|
25
|
+
if (!fs.existsSync(profileConfigPath)) {
|
|
26
|
+
console.error(`❌ No se encontró profile.json en ${domainPath}`);
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const config = JSON.parse(fs.readFileSync(profileConfigPath, 'utf8'));
|
|
31
|
+
|
|
32
|
+
// Función para copiar carpetas completas manteniendo la estructura
|
|
33
|
+
function copyRecursiveSync(src, dest) {
|
|
34
|
+
const exists = fs.existsSync(src);
|
|
35
|
+
const stats = exists && fs.statSync(src);
|
|
36
|
+
const isDirectory = exists && stats.isDirectory();
|
|
37
|
+
if (isDirectory) {
|
|
38
|
+
if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
|
|
39
|
+
fs.readdirSync(src).forEach(childItemName => {
|
|
40
|
+
copyRecursiveSync(path.join(src, childItemName), path.join(dest, childItemName));
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
fs.copyFileSync(src, dest);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
25
46
|
|
|
26
|
-
console.log(`🚀 Instalando inteligencia para ${profileKey}...`);
|
|
47
|
+
console.log(`🚀 Instalando inteligencia estructurada para ${profileKey}...`);
|
|
27
48
|
|
|
28
|
-
//
|
|
49
|
+
// 1. Proyectar el Agente (agent.md) si existe
|
|
50
|
+
const agentFile = path.join(domainPath, 'agent.md');
|
|
51
|
+
if (fs.existsSync(agentFile)) {
|
|
52
|
+
if (!fs.existsSync(TARGET_BASE_DIR)) fs.mkdirSync(TARGET_BASE_DIR, { recursive: true });
|
|
53
|
+
fs.copyFileSync(agentFile, path.join(TARGET_BASE_DIR, 'agent.md'));
|
|
54
|
+
console.log(` 🤖 Agente proyectado en la raíz del perfil.`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 2. Proyectar carpetas del profile.json manteniendo su jerarquía
|
|
29
58
|
config.include_dirs.forEach(dirName => {
|
|
30
59
|
const sourceDir = path.join(domainPath, dirName);
|
|
60
|
+
const targetDir = path.join(TARGET_BASE_DIR, dirName);
|
|
31
61
|
|
|
32
62
|
if (fs.existsSync(sourceDir)) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Solo copiamos archivos (evitamos subcarpetas por ahora)
|
|
36
|
-
const srcFile = path.join(sourceDir, file);
|
|
37
|
-
if (fs.lstatSync(srcFile).isFile()) {
|
|
38
|
-
fs.copyFileSync(srcFile, path.join(TARGET_DIR, file));
|
|
39
|
-
console.log(` ✅ [${dirName}] ${file} proyectado.`);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
63
|
+
copyRecursiveSync(sourceDir, targetDir);
|
|
64
|
+
console.log(` 📁 Estructura [${dirName}] proyectada.`);
|
|
42
65
|
}
|
|
43
66
|
});
|
|
44
67
|
|
|
45
|
-
console.log(`\n✨ Perfil ${profileKey}
|
|
68
|
+
console.log(`\n✨ Perfil ${profileKey} instalado en .cursor/ai-platform/${profileKey}`);
|
|
69
|
+
console.log(`💡 Ahora puedes referenciar al agente con @agent.md desde esa carpeta.`);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { Server } = require("@modelcontextprotocol/sdk/server/index.js");
|
|
3
|
+
const { StdioServerTransport } = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
4
|
+
const { CallToolRequestSchema, ListToolsRequestSchema } = require("@modelcontextprotocol/sdk/types.js");
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
const path = require('path');
|
|
7
|
+
const axios = require('axios');
|
|
8
|
+
|
|
9
|
+
function loadConfig() {
|
|
10
|
+
const configPath = process.env.AI_PLATFORM_CONFIG;
|
|
11
|
+
if (!configPath || !fs.existsSync(configPath)) {
|
|
12
|
+
const defaultPath = path.join(process.env.HOME || process.env.USERPROFILE, '.ai-platform', 'config.json');
|
|
13
|
+
if (fs.existsSync(defaultPath)) return JSON.parse(fs.readFileSync(defaultPath, 'utf8'));
|
|
14
|
+
console.error("❌ Archivo de configuración no encontrado.");
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
return JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const config = loadConfig();
|
|
21
|
+
|
|
22
|
+
// --- INICIALIZACIÓN DEL SERVIDOR ---
|
|
23
|
+
const server = new Server({
|
|
24
|
+
name: "tismart-belcorp-bridge",
|
|
25
|
+
version: "0.0.9"
|
|
26
|
+
}, {
|
|
27
|
+
capabilities: { tools: {} }
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// --- DEFINICIÓN DE HERRAMIENTAS (TOOLS) ---
|
|
31
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
32
|
+
tools: [
|
|
33
|
+
{
|
|
34
|
+
name: "get_jira_ticket",
|
|
35
|
+
description: "Consulta información detallada de un ticket en el Jira de Belcorp.",
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: "object",
|
|
38
|
+
properties: {
|
|
39
|
+
issueKey: { type: "string", description: "El ID del ticket, ej: QA-123" }
|
|
40
|
+
},
|
|
41
|
+
required: ["issueKey"]
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "get_sdp_request",
|
|
46
|
+
description: "Obtiene los datos de un requerimiento de Service Desk Plus (SDP) Belcorp.",
|
|
47
|
+
inputSchema: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
requestId: { type: "string", description: "ID de la solicitud en SDP" }
|
|
51
|
+
},
|
|
52
|
+
required: ["requestId"]
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "search_confluence_rca",
|
|
57
|
+
description: "Busca documentos de RCA o conocimiento en Confluence Belcorp.",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
query: { type: "string", description: "Término de búsqueda para RCAs" }
|
|
62
|
+
},
|
|
63
|
+
required: ["query"]
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}));
|
|
68
|
+
|
|
69
|
+
// --- MANEJADOR DE EJECUCIÓN (Lógica Real) ---
|
|
70
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) =>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fernando.zavaleta/ai-platform-core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.11-beta",
|
|
4
4
|
"description": "Enterprise AI Framework Distribution Tool",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,5 +14,9 @@
|
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
16
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
17
|
+
},
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
20
|
+
"axios": "^1.13.6"
|
|
17
21
|
}
|
|
18
22
|
}
|