igniteui-cli 15.8.3-alpha.0 → 15.9.0
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/execute.js +32 -9
- package/lib/commands/mcp.d.ts +11 -0
- package/lib/commands/mcp.js +41 -0
- package/lib/commands/new.js +3 -1
- package/package.json +5 -5
- package/templates/react/igr-ts/projects/base/index.d.ts +0 -1
- package/templates/react/igr-ts/projects/base/index.js +0 -27
- package/templates/react/igr-ts/projects/empty/index.d.ts +0 -1
- package/templates/react/igr-ts/projects/empty/index.js +0 -27
- package/templates/webcomponents/igc-ts/projects/base/index.d.ts +0 -1
- package/templates/webcomponents/igc-ts/projects/base/index.js +0 -27
- package/templates/webcomponents/igc-ts/projects/empty/index.d.ts +0 -1
- package/templates/webcomponents/igc-ts/projects/empty/index.js +0 -27
package/bin/execute.js
CHANGED
|
@@ -2,29 +2,52 @@
|
|
|
2
2
|
const fs = require("fs");
|
|
3
3
|
const resolve = require("resolve");
|
|
4
4
|
const path = require("path");
|
|
5
|
+
const { pathToFileURL } = require("url");
|
|
5
6
|
const { hideBin } = require("yargs/helpers");
|
|
6
7
|
|
|
7
8
|
const args = hideBin(process.argv);
|
|
8
9
|
|
|
9
10
|
//execute -g igniteui-cli in case there is no project installed, else resolve to the local one
|
|
10
11
|
resolve("igniteui-cli", { basedir: process.cwd() }, function (err, res) {
|
|
11
|
-
let cli;
|
|
12
|
+
let cliPath = "../lib/cli";
|
|
12
13
|
if (res && res.indexOf(process.cwd()) > -1) {
|
|
13
14
|
const localVersion = require(path.join(process.cwd(), "node_modules/igniteui-cli/package.json"))["version"];
|
|
14
15
|
const globalVersion = require(path.join(__dirname, "../package.json"))["version"];
|
|
15
16
|
if (globalVersion !== localVersion) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (args[0] === "ai-config") {
|
|
19
|
-
cli = require("../lib/cli");
|
|
20
|
-
} else {
|
|
21
|
-
cli = require(res);
|
|
17
|
+
// stderr, because stdout carries the protocol messages when `ig mcp` runs the MCP server
|
|
18
|
+
console.error("Different igniteui-cli global and local version");
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (args[0] !== "ai-config") {
|
|
21
|
+
cliPath = res;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (args[0] === "mcp" && startMcpServer(path.dirname(require.resolve(cliPath)))) {
|
|
25
|
+
return;
|
|
25
26
|
}
|
|
27
|
+
const cli = require(cliPath);
|
|
26
28
|
cli.run(args).catch(function (err) {
|
|
27
29
|
console.error("Error: " + (err.message || err));
|
|
28
30
|
process.exit(1);
|
|
29
31
|
});
|
|
30
32
|
});
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Starts the MCP server bundled with the CLI copy in `cliDir` in this process, before the CLI loads, so a session
|
|
36
|
+
* runs one Node process and skips loading the CLI and its templates.
|
|
37
|
+
* @returns false when `ig mcp` should run through the CLI instead (help, other options, server missing or not built)
|
|
38
|
+
*/
|
|
39
|
+
function startMcpServer(cliDir) {
|
|
40
|
+
const { getMcpServerArgs, resolveMcpServerEntry } = require("../lib/commands/mcp");
|
|
41
|
+
const serverArgs = getMcpServerArgs(args.slice(1));
|
|
42
|
+
const mcpEntry = serverArgs && resolveMcpServerEntry(cliDir);
|
|
43
|
+
if (!mcpEntry) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
// the server reads its options from process.argv when it loads
|
|
47
|
+
process.argv = [process.argv[0], mcpEntry, ...serverArgs];
|
|
48
|
+
import(pathToFileURL(mcpEntry).href).catch(function (err) {
|
|
49
|
+
console.error("Failed to start MCP server: " + (err.message || err));
|
|
50
|
+
process.exit(1);
|
|
51
|
+
});
|
|
52
|
+
return true;
|
|
53
|
+
}
|
package/lib/commands/mcp.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
1
|
import { CommandType } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Resolves the built MCP server entry installed with the CLI copy in `cliDir`.
|
|
4
|
+
* @returns the entry path, or `null` when the server package is missing or not built
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveMcpServerEntry(cliDir: string): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* Maps the options of `ig mcp` to the server's own command line, which reads only `--remote <url>` and `--debug`.
|
|
9
|
+
* @param args the arguments after `mcp`
|
|
10
|
+
* @returns the server arguments, or `null` when the CLI must parse them (help, version, other or incomplete options)
|
|
11
|
+
*/
|
|
12
|
+
export declare function getMcpServerArgs(args: string[]): string[] | null;
|
|
2
13
|
declare const command: CommandType;
|
|
3
14
|
export default command;
|
package/lib/commands/mcp.js
CHANGED
|
@@ -32,9 +32,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.resolveMcpServerEntry = resolveMcpServerEntry;
|
|
36
|
+
exports.getMcpServerArgs = getMcpServerArgs;
|
|
35
37
|
const fs = __importStar(require("fs"));
|
|
36
38
|
const path = __importStar(require("path"));
|
|
37
39
|
const child_process_1 = require("child_process");
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the built MCP server entry installed with the CLI copy in `cliDir`.
|
|
42
|
+
* @returns the entry path, or `null` when the server package is missing or not built
|
|
43
|
+
*/
|
|
44
|
+
function resolveMcpServerEntry(cliDir) {
|
|
45
|
+
try {
|
|
46
|
+
// resolve from the real folder: pnpm links packages and keeps their dependencies next to the link target
|
|
47
|
+
const mcpPkgJson = require.resolve("@igniteui/mcp-server/package.json", { paths: [fs.realpathSync(cliDir)] });
|
|
48
|
+
const mcpEntry = path.resolve(path.dirname(mcpPkgJson), "dist", "index.js");
|
|
49
|
+
return fs.existsSync(mcpEntry) ? mcpEntry : null;
|
|
50
|
+
}
|
|
51
|
+
catch (_a) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Maps the options of `ig mcp` to the server's own command line, which reads only `--remote <url>` and `--debug`.
|
|
57
|
+
* @param args the arguments after `mcp`
|
|
58
|
+
* @returns the server arguments, or `null` when the CLI must parse them (help, version, other or incomplete options)
|
|
59
|
+
*/
|
|
60
|
+
function getMcpServerArgs(args) {
|
|
61
|
+
const serverArgs = [];
|
|
62
|
+
for (let i = 0; i < args.length; i++) {
|
|
63
|
+
const arg = args[i];
|
|
64
|
+
if (arg === "--debug") {
|
|
65
|
+
serverArgs.push(arg);
|
|
66
|
+
}
|
|
67
|
+
else if (arg === "--remote" && args[i + 1] && !args[i + 1].startsWith("-")) {
|
|
68
|
+
serverArgs.push(arg, args[++i]);
|
|
69
|
+
}
|
|
70
|
+
else if (arg.startsWith("--remote=") && arg.length > "--remote=".length) {
|
|
71
|
+
serverArgs.push("--remote", arg.slice("--remote=".length));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return serverArgs;
|
|
78
|
+
}
|
|
38
79
|
const command = {
|
|
39
80
|
command: "mcp",
|
|
40
81
|
describe: "Starts the Ignite UI MCP server for AI assistant integration",
|
package/lib/commands/new.js
CHANGED
|
@@ -219,7 +219,9 @@ const command = {
|
|
|
219
219
|
}
|
|
220
220
|
const config = projTemplate.generateConfig(argv.name, theme);
|
|
221
221
|
for (const templatePath of projTemplate.templatePaths) {
|
|
222
|
-
yield cli_core_1.Util.processTemplates(templatePath, path.join(process.cwd(), argv.name), config, projTemplate.delimiters, false)
|
|
222
|
+
if (!(yield cli_core_1.Util.processTemplates(templatePath, path.join(process.cwd(), argv.name), config, projTemplate.delimiters, false))) {
|
|
223
|
+
return cli_core_1.Util.error("Project generation failed!", "red");
|
|
224
|
+
}
|
|
223
225
|
}
|
|
224
226
|
process.chdir(argv.name);
|
|
225
227
|
yield (0, ai_config_1.configure)(argv.framework, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "igniteui-cli",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.9.0",
|
|
4
4
|
"description": "CLI tool for creating Ignite UI projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
"all": true
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@igniteui/angular-templates": "~22.2.
|
|
70
|
-
"@igniteui/cli-core": "~15.
|
|
71
|
-
"@igniteui/mcp-server": "~15.
|
|
69
|
+
"@igniteui/angular-templates": "~22.2.1590",
|
|
70
|
+
"@igniteui/cli-core": "~15.9.0",
|
|
71
|
+
"@igniteui/mcp-server": "~15.9.0",
|
|
72
72
|
"@inquirer/prompts": "^7.9.0",
|
|
73
73
|
"chalk": "^5.3.0",
|
|
74
|
-
"glob": "^
|
|
74
|
+
"glob": "^14.0.2",
|
|
75
75
|
"open": "^10.1.0",
|
|
76
76
|
"resolve": "^1.22.8",
|
|
77
77
|
"through2": "^4.0.2",
|
|
@@ -9,7 +9,6 @@ export declare class BasePageIgrTsProject extends BaseIgrTsProject implements Pr
|
|
|
9
9
|
projectType: string;
|
|
10
10
|
hasExtraConfiguration: boolean;
|
|
11
11
|
isHidden: boolean;
|
|
12
|
-
get templatePaths(): string[];
|
|
13
12
|
}
|
|
14
13
|
declare const _default: BasePageIgrTsProject;
|
|
15
14
|
export default _default;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.BasePageIgrTsProject = void 0;
|
|
27
|
-
const path = __importStar(require("path"));
|
|
28
4
|
const _base_1 = require("../_base");
|
|
29
5
|
class BasePageIgrTsProject extends _base_1.BaseIgrTsProject {
|
|
30
6
|
constructor() {
|
|
@@ -38,9 +14,6 @@ class BasePageIgrTsProject extends _base_1.BaseIgrTsProject {
|
|
|
38
14
|
this.hasExtraConfiguration = false;
|
|
39
15
|
this.isHidden = true;
|
|
40
16
|
}
|
|
41
|
-
get templatePaths() {
|
|
42
|
-
return [...super.templatePaths, path.join(__dirname, "files")];
|
|
43
|
-
}
|
|
44
17
|
}
|
|
45
18
|
exports.BasePageIgrTsProject = BasePageIgrTsProject;
|
|
46
19
|
exports.default = new BasePageIgrTsProject();
|
|
@@ -9,7 +9,6 @@ export declare class EmptyIgrTsProject extends BaseWithHomeIgrTsProject implemen
|
|
|
9
9
|
projectType: string;
|
|
10
10
|
hasExtraConfiguration: boolean;
|
|
11
11
|
isHidden: boolean;
|
|
12
|
-
get templatePaths(): string[];
|
|
13
12
|
}
|
|
14
13
|
declare const _default: EmptyIgrTsProject;
|
|
15
14
|
export default _default;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.EmptyIgrTsProject = void 0;
|
|
27
|
-
const path = __importStar(require("path"));
|
|
28
4
|
const _base_with_home_1 = require("../_base_with_home");
|
|
29
5
|
class EmptyIgrTsProject extends _base_with_home_1.BaseWithHomeIgrTsProject {
|
|
30
6
|
constructor() {
|
|
@@ -38,9 +14,6 @@ class EmptyIgrTsProject extends _base_with_home_1.BaseWithHomeIgrTsProject {
|
|
|
38
14
|
this.hasExtraConfiguration = false;
|
|
39
15
|
this.isHidden = false;
|
|
40
16
|
}
|
|
41
|
-
get templatePaths() {
|
|
42
|
-
return [...super.templatePaths, path.join(__dirname, "files")];
|
|
43
|
-
}
|
|
44
17
|
}
|
|
45
18
|
exports.EmptyIgrTsProject = EmptyIgrTsProject;
|
|
46
19
|
exports.default = new EmptyIgrTsProject();
|
|
@@ -9,7 +9,6 @@ export declare class BasePageTemplate extends BaseIgcProject implements ProjectT
|
|
|
9
9
|
dependencies: string[];
|
|
10
10
|
hasExtraConfiguration: boolean;
|
|
11
11
|
isHidden: boolean;
|
|
12
|
-
get templatePaths(): string[];
|
|
13
12
|
}
|
|
14
13
|
declare const _default: BasePageTemplate;
|
|
15
14
|
export default _default;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.BasePageTemplate = void 0;
|
|
27
|
-
const path = __importStar(require("path"));
|
|
28
4
|
const _base_1 = require("../_base");
|
|
29
5
|
class BasePageTemplate extends _base_1.BaseIgcProject {
|
|
30
6
|
constructor() {
|
|
@@ -37,9 +13,6 @@ class BasePageTemplate extends _base_1.BaseIgcProject {
|
|
|
37
13
|
this.hasExtraConfiguration = false;
|
|
38
14
|
this.isHidden = true;
|
|
39
15
|
}
|
|
40
|
-
get templatePaths() {
|
|
41
|
-
return [...super.templatePaths, path.join(__dirname, "files")];
|
|
42
|
-
}
|
|
43
16
|
}
|
|
44
17
|
exports.BasePageTemplate = BasePageTemplate;
|
|
45
18
|
exports.default = new BasePageTemplate();
|
|
@@ -9,7 +9,6 @@ export declare class EmptyPageTemplate extends BaseWithHomeIgcProject implements
|
|
|
9
9
|
dependencies: string[];
|
|
10
10
|
hasExtraConfiguration: boolean;
|
|
11
11
|
isHidden: boolean;
|
|
12
|
-
get templatePaths(): string[];
|
|
13
12
|
}
|
|
14
13
|
declare const _default: EmptyPageTemplate;
|
|
15
14
|
export default _default;
|
|
@@ -1,30 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.EmptyPageTemplate = void 0;
|
|
27
|
-
const path = __importStar(require("path"));
|
|
28
4
|
const _base_with_home_1 = require("../_base_with_home");
|
|
29
5
|
class EmptyPageTemplate extends _base_with_home_1.BaseWithHomeIgcProject {
|
|
30
6
|
constructor() {
|
|
@@ -37,9 +13,6 @@ class EmptyPageTemplate extends _base_with_home_1.BaseWithHomeIgcProject {
|
|
|
37
13
|
this.hasExtraConfiguration = false;
|
|
38
14
|
this.isHidden = false;
|
|
39
15
|
}
|
|
40
|
-
get templatePaths() {
|
|
41
|
-
return [...super.templatePaths, path.join(__dirname, "files")];
|
|
42
|
-
}
|
|
43
16
|
}
|
|
44
17
|
exports.EmptyPageTemplate = EmptyPageTemplate;
|
|
45
18
|
exports.default = new EmptyPageTemplate();
|