@linkup-ai/abap-ai 2.2.0 → 2.2.1
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/dist/cli/init.js +19 -10
- package/dist/cli/remove.js +8 -6
- package/dist/cli/systems.js +9 -6
- package/dist/cli.js +14 -10
- package/package.json +1 -1
package/dist/cli/init.js
CHANGED
|
@@ -42,7 +42,11 @@ const fs = __importStar(require("fs"));
|
|
|
42
42
|
const path = __importStar(require("path"));
|
|
43
43
|
const https = __importStar(require("https"));
|
|
44
44
|
const http = __importStar(require("http"));
|
|
45
|
-
const
|
|
45
|
+
const GLOBAL_MCP_PATH = path.join(process.env.HOME || "~", ".claude", "mcp.json");
|
|
46
|
+
const LOCAL_MCP_PATH = path.join(process.cwd(), ".claude", "mcp.json");
|
|
47
|
+
function getMcpPath(local) {
|
|
48
|
+
return local ? LOCAL_MCP_PATH : GLOBAL_MCP_PATH;
|
|
49
|
+
}
|
|
46
50
|
// ---------------------------------------------------------------------------
|
|
47
51
|
// Teste de conexão SAP
|
|
48
52
|
// ---------------------------------------------------------------------------
|
|
@@ -115,21 +119,21 @@ async function testConnection(system) {
|
|
|
115
119
|
// ---------------------------------------------------------------------------
|
|
116
120
|
// mcp.json management
|
|
117
121
|
// ---------------------------------------------------------------------------
|
|
118
|
-
function readMcpConfig() {
|
|
122
|
+
function readMcpConfig(mcpPath) {
|
|
119
123
|
try {
|
|
120
|
-
const raw = fs.readFileSync(
|
|
124
|
+
const raw = fs.readFileSync(mcpPath, "utf-8");
|
|
121
125
|
return JSON.parse(raw);
|
|
122
126
|
}
|
|
123
127
|
catch {
|
|
124
128
|
return { mcpServers: {} };
|
|
125
129
|
}
|
|
126
130
|
}
|
|
127
|
-
function writeMcpConfig(config) {
|
|
128
|
-
const dir = path.dirname(
|
|
131
|
+
function writeMcpConfig(config, mcpPath) {
|
|
132
|
+
const dir = path.dirname(mcpPath);
|
|
129
133
|
if (!fs.existsSync(dir)) {
|
|
130
134
|
fs.mkdirSync(dir, { recursive: true });
|
|
131
135
|
}
|
|
132
|
-
fs.writeFileSync(
|
|
136
|
+
fs.writeFileSync(mcpPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
133
137
|
}
|
|
134
138
|
function detectServerPath() {
|
|
135
139
|
// Tentar encontrar o index.js relativo ao CLI
|
|
@@ -249,14 +253,19 @@ async function promptSystem() {
|
|
|
249
253
|
// ---------------------------------------------------------------------------
|
|
250
254
|
// Main
|
|
251
255
|
// ---------------------------------------------------------------------------
|
|
252
|
-
async function init() {
|
|
256
|
+
async function init(options = {}) {
|
|
257
|
+
const local = options.local ?? false;
|
|
258
|
+
const mcpPath = getMcpPath(local);
|
|
259
|
+
const scope = local ? `projeto (${process.cwd()})` : "global";
|
|
253
260
|
console.log(`
|
|
254
261
|
╭─────────────────────────────────────╮
|
|
255
262
|
│ LKPABAP.ai — Setup │
|
|
256
263
|
│ Conecte o Claude ao seu SAP │
|
|
257
264
|
╰─────────────────────────────────────╯
|
|
265
|
+
|
|
266
|
+
Escopo: ${scope}
|
|
258
267
|
`);
|
|
259
|
-
const config = readMcpConfig();
|
|
268
|
+
const config = readMcpConfig(mcpPath);
|
|
260
269
|
const existingCount = Object.keys(config.mcpServers).filter((k) => k.startsWith("abap-")).length;
|
|
261
270
|
if (existingCount > 0) {
|
|
262
271
|
console.log(` ${existingCount} sistema(s) SAP já configurado(s).\n`);
|
|
@@ -320,10 +329,10 @@ async function init() {
|
|
|
320
329
|
addMore = more;
|
|
321
330
|
}
|
|
322
331
|
if (addedSystems.length > 0) {
|
|
323
|
-
writeMcpConfig(config);
|
|
332
|
+
writeMcpConfig(config, mcpPath);
|
|
324
333
|
const total = Object.keys(config.mcpServers).filter((k) => k.startsWith("abap-")).length;
|
|
325
334
|
console.log(`
|
|
326
|
-
✓ Configuração salva em ${
|
|
335
|
+
✓ Configuração salva em ${mcpPath}
|
|
327
336
|
|
|
328
337
|
╭──────────────────────────────────────────────╮
|
|
329
338
|
│ ${total} sistema(s) configurado(s):${" ".repeat(Math.max(0, 23 - total.toString().length))}│`);
|
package/dist/cli/remove.js
CHANGED
|
@@ -40,16 +40,18 @@ exports.remove = remove;
|
|
|
40
40
|
const prompts_1 = __importDefault(require("prompts"));
|
|
41
41
|
const fs = __importStar(require("fs"));
|
|
42
42
|
const path = __importStar(require("path"));
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const GLOBAL_MCP_PATH = path.join(process.env.HOME || "~", ".claude", "mcp.json");
|
|
44
|
+
const LOCAL_MCP_PATH = path.join(process.cwd(), ".claude", "mcp.json");
|
|
45
|
+
async function remove(name, options = {}) {
|
|
45
46
|
const serverName = name.startsWith("abap-") ? name : `abap-${name}`;
|
|
47
|
+
const mcpPath = options.local ? LOCAL_MCP_PATH : GLOBAL_MCP_PATH;
|
|
46
48
|
let config;
|
|
47
49
|
try {
|
|
48
|
-
const raw = fs.readFileSync(
|
|
50
|
+
const raw = fs.readFileSync(mcpPath, "utf-8");
|
|
49
51
|
config = JSON.parse(raw);
|
|
50
52
|
}
|
|
51
53
|
catch {
|
|
52
|
-
console.error(` ✗ Arquivo ${
|
|
54
|
+
console.error(` ✗ Arquivo ${mcpPath} não encontrado.`);
|
|
53
55
|
process.exit(1);
|
|
54
56
|
return;
|
|
55
57
|
}
|
|
@@ -73,8 +75,8 @@ async function remove(name) {
|
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
77
|
delete config.mcpServers[serverName];
|
|
76
|
-
fs.writeFileSync(
|
|
78
|
+
fs.writeFileSync(mcpPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
77
79
|
const remaining = Object.keys(config.mcpServers).filter((k) => k.startsWith("abap-")).length;
|
|
78
|
-
console.log(`\n ✓ Sistema "${serverName}" removido de ${
|
|
80
|
+
console.log(`\n ✓ Sistema "${serverName}" removido de ${mcpPath}`);
|
|
79
81
|
console.log(` ${remaining} sistema(s) restante(s).\n`);
|
|
80
82
|
}
|
package/dist/cli/systems.js
CHANGED
|
@@ -36,25 +36,28 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.systems = systems;
|
|
37
37
|
const fs = __importStar(require("fs"));
|
|
38
38
|
const path = __importStar(require("path"));
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const GLOBAL_MCP_PATH = path.join(process.env.HOME || "~", ".claude", "mcp.json");
|
|
40
|
+
const LOCAL_MCP_PATH = path.join(process.cwd(), ".claude", "mcp.json");
|
|
41
|
+
async function systems(options = {}) {
|
|
42
|
+
const mcpPath = options.local ? LOCAL_MCP_PATH : GLOBAL_MCP_PATH;
|
|
41
43
|
let config;
|
|
42
44
|
try {
|
|
43
|
-
const raw = fs.readFileSync(
|
|
45
|
+
const raw = fs.readFileSync(mcpPath, "utf-8");
|
|
44
46
|
config = JSON.parse(raw);
|
|
45
47
|
}
|
|
46
48
|
catch {
|
|
47
49
|
console.log("\n Nenhum sistema configurado.");
|
|
48
|
-
console.log(
|
|
50
|
+
console.log(` → Execute: abap-ai init${options.local ? " --local" : ""}\n`);
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
53
|
const sapServers = Object.entries(config.mcpServers || {}).filter(([k]) => k.startsWith("abap-"));
|
|
52
54
|
if (sapServers.length === 0) {
|
|
53
55
|
console.log("\n Nenhum sistema SAP configurado.");
|
|
54
|
-
console.log(
|
|
56
|
+
console.log(` → Execute: abap-ai init${options.local ? " --local" : ""}\n`);
|
|
55
57
|
return;
|
|
56
58
|
}
|
|
57
|
-
|
|
59
|
+
const scope = options.local ? `projeto (${process.cwd()})` : "global";
|
|
60
|
+
console.log(`\n Sistemas SAP (${sapServers.length}) — ${scope}:`);
|
|
58
61
|
console.log(" " + "─".repeat(60));
|
|
59
62
|
for (const [name, server] of sapServers) {
|
|
60
63
|
const env = server.env || {};
|
package/dist/cli.js
CHANGED
|
@@ -6,7 +6,7 @@ const activate_js_1 = require("./cli/activate.js");
|
|
|
6
6
|
const status_js_1 = require("./cli/status.js");
|
|
7
7
|
const remove_js_1 = require("./cli/remove.js");
|
|
8
8
|
const systems_js_1 = require("./cli/systems.js");
|
|
9
|
-
const VERSION = "2.
|
|
9
|
+
const VERSION = "2.2.1";
|
|
10
10
|
const HELP = `
|
|
11
11
|
LKPABAP.ai — AI-powered ABAP development for SAP
|
|
12
12
|
|
|
@@ -14,21 +14,24 @@ const HELP = `
|
|
|
14
14
|
abap-ai <comando> [opções]
|
|
15
15
|
|
|
16
16
|
Comandos:
|
|
17
|
-
init
|
|
17
|
+
init [--local] Configura conexão com sistema SAP (wizard interativo)
|
|
18
18
|
activate <LICENSE_KEY> Ativa licença do produto
|
|
19
19
|
status Mostra licença, sistemas e métricas de uso
|
|
20
|
-
systems
|
|
21
|
-
remove <nome>
|
|
20
|
+
systems [--local] Lista sistemas SAP configurados
|
|
21
|
+
remove <nome> [--local] Remove um sistema SAP do mcp.json
|
|
22
22
|
|
|
23
23
|
Opções:
|
|
24
|
+
--local Usa config do projeto atual (.claude/mcp.json) em vez do global
|
|
24
25
|
--version, -v Mostra versão
|
|
25
26
|
--help, -h Mostra esta ajuda
|
|
26
27
|
|
|
27
28
|
Exemplos:
|
|
28
|
-
abap-ai init Wizard
|
|
29
|
+
abap-ai init Wizard global (todos os workspaces)
|
|
30
|
+
abap-ai init --local Wizard para este workspace/projeto apenas
|
|
29
31
|
abap-ai activate LK-XXXX Ativa licença
|
|
30
32
|
abap-ai status Verifica estado do ambiente
|
|
31
|
-
abap-ai remove novaforma-qas Remove sistema
|
|
33
|
+
abap-ai remove novaforma-qas Remove sistema (config global)
|
|
34
|
+
abap-ai remove rdg --local Remove sistema da config do projeto
|
|
32
35
|
`;
|
|
33
36
|
async function main() {
|
|
34
37
|
const args = process.argv.slice(2);
|
|
@@ -41,9 +44,10 @@ async function main() {
|
|
|
41
44
|
console.log(`LKPABAP.ai v${VERSION}`);
|
|
42
45
|
return;
|
|
43
46
|
}
|
|
47
|
+
const local = args.includes("--local");
|
|
44
48
|
switch (command) {
|
|
45
49
|
case "init":
|
|
46
|
-
await (0, init_js_1.init)();
|
|
50
|
+
await (0, init_js_1.init)({ local });
|
|
47
51
|
break;
|
|
48
52
|
case "activate": {
|
|
49
53
|
const key = args[1];
|
|
@@ -58,15 +62,15 @@ async function main() {
|
|
|
58
62
|
await (0, status_js_1.status)();
|
|
59
63
|
break;
|
|
60
64
|
case "systems":
|
|
61
|
-
await (0, systems_js_1.systems)();
|
|
65
|
+
await (0, systems_js_1.systems)({ local });
|
|
62
66
|
break;
|
|
63
67
|
case "remove": {
|
|
64
|
-
const name = args[1];
|
|
68
|
+
const name = args.filter((a) => !a.startsWith("--"))[1];
|
|
65
69
|
if (!name) {
|
|
66
70
|
console.error(" ✗ Informe o nome do sistema: abap-ai remove <nome>");
|
|
67
71
|
process.exit(1);
|
|
68
72
|
}
|
|
69
|
-
await (0, remove_js_1.remove)(name);
|
|
73
|
+
await (0, remove_js_1.remove)(name, { local });
|
|
70
74
|
break;
|
|
71
75
|
}
|
|
72
76
|
default:
|