igel-qe-core 1.0.1 → 1.0.2
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/index.js +22 -2
- package/dist/cli/platform.js +66 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { spawn } from "child_process";
|
|
5
|
+
import { setupPlatform } from "./platform.js";
|
|
5
6
|
const program = new Command();
|
|
6
7
|
program
|
|
7
8
|
.name("igel-qe")
|
|
@@ -10,7 +11,10 @@ program
|
|
|
10
11
|
program
|
|
11
12
|
.command("init")
|
|
12
13
|
.description("Bootstrap the Python AI Platform Layer")
|
|
13
|
-
.
|
|
14
|
+
.option("--with-copilot", "Auto-configure for GitHub Copilot in VS Code")
|
|
15
|
+
.option("--with-cline", "Auto-configure for Cline")
|
|
16
|
+
.option("--with-all", "Auto-configure all supported platforms")
|
|
17
|
+
.action(async (options) => {
|
|
14
18
|
console.log(chalk.blue("Initializing IGEL QE AI Platform..."));
|
|
15
19
|
const steps = [
|
|
16
20
|
"1. Checking Python version...",
|
|
@@ -27,7 +31,13 @@ program
|
|
|
27
31
|
console.log(chalk.green(` ✓ Done`));
|
|
28
32
|
}
|
|
29
33
|
console.log(chalk.bold.green("\nIGEL QE AI Platform successfully initialized!"));
|
|
30
|
-
|
|
34
|
+
if (options.withCopilot || options.withAll) {
|
|
35
|
+
await setupPlatform('copilot');
|
|
36
|
+
}
|
|
37
|
+
if (options.withCline || options.withAll) {
|
|
38
|
+
await setupPlatform('cline');
|
|
39
|
+
}
|
|
40
|
+
console.log(`You can now use GitHub Copilot or Cline to invoke MCP tools or run commands via this CLI.`);
|
|
31
41
|
});
|
|
32
42
|
program
|
|
33
43
|
.command("sync")
|
|
@@ -59,4 +69,14 @@ program
|
|
|
59
69
|
});
|
|
60
70
|
});
|
|
61
71
|
});
|
|
72
|
+
const platformCmd = program
|
|
73
|
+
.command("platform")
|
|
74
|
+
.description("Manage coding agent platform configurations");
|
|
75
|
+
platformCmd
|
|
76
|
+
.command("setup <platform>")
|
|
77
|
+
.description("Setup an MCP configuration for a specific platform (copilot, cline)")
|
|
78
|
+
.action(async (platform) => {
|
|
79
|
+
console.log(chalk.blue(`Setting up configuration for ${platform}...`));
|
|
80
|
+
await setupPlatform(platform);
|
|
81
|
+
});
|
|
62
82
|
program.parse();
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import * as os from 'os';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
export async function setupPlatform(platform) {
|
|
6
|
+
const homeDir = os.homedir();
|
|
7
|
+
// The command we want to inject
|
|
8
|
+
const mcpServerConfig = {
|
|
9
|
+
command: process.platform === 'win32' ? 'igel-qe-mcp.cmd' : 'igel-qe-mcp',
|
|
10
|
+
args: []
|
|
11
|
+
};
|
|
12
|
+
try {
|
|
13
|
+
if (platform === 'copilot') {
|
|
14
|
+
// Setup for GitHub Copilot in VS Code
|
|
15
|
+
// VS Code user settings on Windows usually live in AppData/Roaming/Code/User
|
|
16
|
+
let vscodeSettingsPath = path.join(homeDir, 'AppData', 'Roaming', 'Code', 'User', 'settings.json');
|
|
17
|
+
if (process.platform !== 'win32') {
|
|
18
|
+
vscodeSettingsPath = path.join(homeDir, '.config', 'Code', 'User', 'settings.json');
|
|
19
|
+
}
|
|
20
|
+
let settings = {};
|
|
21
|
+
if (fs.existsSync(vscodeSettingsPath)) {
|
|
22
|
+
const raw = fs.readFileSync(vscodeSettingsPath, 'utf8');
|
|
23
|
+
try {
|
|
24
|
+
settings = JSON.parse(raw);
|
|
25
|
+
}
|
|
26
|
+
catch (e) { /* ignore parse error for now */ }
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
fs.mkdirSync(path.dirname(vscodeSettingsPath), { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
if (!settings['github.copilot.chat.mcp.servers']) {
|
|
32
|
+
settings['github.copilot.chat.mcp.servers'] = {};
|
|
33
|
+
}
|
|
34
|
+
settings['github.copilot.chat.mcp.servers']['igel-qe'] = mcpServerConfig;
|
|
35
|
+
fs.writeFileSync(vscodeSettingsPath, JSON.stringify(settings, null, 2));
|
|
36
|
+
console.log(chalk.green(`✓ Successfully configured GitHub Copilot MCP in ${vscodeSettingsPath}`));
|
|
37
|
+
}
|
|
38
|
+
else if (platform === 'cline') {
|
|
39
|
+
// Setup for Cline (Claude Dev)
|
|
40
|
+
let clineConfigPath = path.join(homeDir, 'AppData', 'Roaming', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json');
|
|
41
|
+
if (process.platform !== 'win32') {
|
|
42
|
+
clineConfigPath = path.join(homeDir, '.config', 'Code', 'User', 'globalStorage', 'saoudrizwan.claude-dev', 'settings', 'cline_mcp_settings.json');
|
|
43
|
+
}
|
|
44
|
+
let settings = { mcpServers: {} };
|
|
45
|
+
if (fs.existsSync(clineConfigPath)) {
|
|
46
|
+
const raw = fs.readFileSync(clineConfigPath, 'utf8');
|
|
47
|
+
try {
|
|
48
|
+
settings = JSON.parse(raw);
|
|
49
|
+
}
|
|
50
|
+
catch (e) { /* ignore parse error */ }
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
fs.mkdirSync(path.dirname(clineConfigPath), { recursive: true });
|
|
54
|
+
}
|
|
55
|
+
settings.mcpServers['igel-qe'] = mcpServerConfig;
|
|
56
|
+
fs.writeFileSync(clineConfigPath, JSON.stringify(settings, null, 2));
|
|
57
|
+
console.log(chalk.green(`✓ Successfully configured Cline MCP in ${clineConfigPath}`));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.log(chalk.yellow(`Platform '${platform}' is not currently supported for auto-setup.`));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
console.error(chalk.red(`Failed to setup ${platform}: ${err.message}`));
|
|
65
|
+
}
|
|
66
|
+
}
|