igniteui-cli 16.0.0-alpha.2 → 16.0.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/README.md CHANGED
@@ -27,6 +27,8 @@ The `igniteui-cli` allows you to easily generate projects using `Ignite UI` comp
27
27
  * [Generate Ignite UI for React project](#generate-ignite-ui-for-react-project)
28
28
  * [Adding components](#adding-components)
29
29
  * [Build and run](#build-and-run)
30
+ * [Search the docs](#search-the-docs)
31
+ * [Check your setup](#check-your-setup)
30
32
  * [Contribution](#contribution)
31
33
 
32
34
  ## Installation
@@ -116,6 +118,24 @@ ig build
116
118
  ig start
117
119
  ```
118
120
 
121
+ ### Search the docs
122
+ `ig doc` searches the documentation bundled with the CLI and prints the results in the terminal. The framework is detected from the current project; pass `-f` outside a project.
123
+ ```bash
124
+ ig doc "row editing" # ranked results with the name of each doc
125
+ ig doc --read grid-row-editing # print one doc by the name from the results
126
+ ig doc "row editing" -f react --limit 5
127
+ ig doc grid --open # search infragistics.com in the browser instead
128
+ ```
129
+ The bundled docs cover Angular, React, Web Components and Blazor. For jQuery use `--open`.
130
+
131
+ ### Check your setup
132
+ `ig doctor` checks the environment (Node.js, npm, git, CLI version), the current project (CLI config, installed Ignite UI packages, trial and licensed packages mixed together, Angular version match), the licensed `@infragistics` feed, and the AI setup written by `ig ai-config`. It changes nothing, prints a fix hint next to each warning or failure, and exits with code 1 when a check fails.
133
+ ```bash
134
+ ig doctor
135
+ ig doctor --offline # skip the checks that need the network
136
+ ig doctor --json # machine-readable results
137
+ ```
138
+
119
139
  ## Contribution
120
140
 
121
141
  See the [Contribution guide](https://github.com/IgniteUI/igniteui-cli/blob/master/.github/CONTRIBUTING.md) to get started.
package/lib/cli.js CHANGED
@@ -32,7 +32,7 @@ function run(args) {
32
32
  cli_core_1.App.container.set(cli_core_1.TEMPLATE_MANAGER, templateManager);
33
33
  commands_1.newCommand.addChoices(templateManager.getFrameworkIds());
34
34
  const registeredCommands = [
35
- commands_1.newCommand, commands_1.add, commands_1.build, commands_1.start, commands_1.generate, commands_1.config, commands_1.doc, commands_1.test, commands_1.list, commands_1.upgrade, commands_1.mcp, commands_1.aiConfig
35
+ commands_1.newCommand, commands_1.add, commands_1.build, commands_1.start, commands_1.generate, commands_1.config, commands_1.doc, commands_1.test, commands_1.list, commands_1.upgrade, commands_1.mcp, commands_1.aiConfig, commands_1.doctor
36
36
  ];
37
37
  const yargsModule = args ? (0, yargs_1.default)(args) : yargs_1.default;
38
38
  let chain = yargsModule
@@ -33,46 +33,204 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
35
  const cli_core_1 = require("@igniteui/cli-core");
36
+ const doc_format_1 = require("../doc-format");
36
37
  const PromptSession_1 = require("../PromptSession");
38
+ const url_1 = require("url");
39
+ const DOC_FRAMEWORKS = [
40
+ { value: "angular", name: "Angular" },
41
+ { value: "react", name: "React" },
42
+ { value: "webcomponents", name: "Web Components" },
43
+ { value: "blazor", name: "Blazor" }
44
+ ];
45
+ const DEFAULT_RESULTS = 10;
46
+ const MAX_RESULTS = 20;
47
+ const OPEN_HINT = `Use "ig doc <term> --open" to search the Infragistics website instead.`;
48
+ function fail(message) {
49
+ cli_core_1.Util.error(message, "red");
50
+ process.exitCode = 1;
51
+ }
52
+ function requestedFramework(argv) {
53
+ var _a, _b;
54
+ return (_b = (_a = argv.framework) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== null && _b !== void 0 ? _b : (0, cli_core_1.detectFramework)();
55
+ }
56
+ /** @param framework the `--framework` option or the detected one; prompts when there is neither */
57
+ function resolveFramework(framework) {
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ if (!framework) {
60
+ if (!cli_core_1.Util.canPrompt()) {
61
+ fail("Could not detect the project framework. Pass it with --framework. " + OPEN_HINT);
62
+ return null;
63
+ }
64
+ framework = yield cli_core_1.InquirerWrapper.select({
65
+ message: "Choose framework:",
66
+ choices: DOC_FRAMEWORKS,
67
+ default: "angular"
68
+ });
69
+ }
70
+ if (!DOC_FRAMEWORKS.some(x => x.value === framework)) {
71
+ fail(`There are no bundled docs for ${framework}. ` + OPEN_HINT);
72
+ return null;
73
+ }
74
+ return framework;
75
+ });
76
+ }
77
+ function getProvider() {
78
+ return __awaiter(this, void 0, void 0, function* () {
79
+ try {
80
+ const api = yield doc.loadDocs();
81
+ const provider = new api.LocalDocsProvider();
82
+ yield provider.init();
83
+ return { api, provider };
84
+ }
85
+ catch (error) {
86
+ fail(`The bundled docs are not available: ${error.message}` + "\n" + OPEN_HINT);
87
+ return null;
88
+ }
89
+ });
90
+ }
91
+ function searchLocal(argv, requested) {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ var _a;
94
+ const term = argv.term.trim();
95
+ const limit = (_a = argv.limit) !== null && _a !== void 0 ? _a : DEFAULT_RESULTS;
96
+ if (!Number.isInteger(limit) || limit < 1) {
97
+ return fail(`--limit takes a whole number from 1 to ${MAX_RESULTS}.`);
98
+ }
99
+ const framework = yield resolveFramework(requested);
100
+ if (!framework) {
101
+ return;
102
+ }
103
+ const docs = yield getProvider();
104
+ if (!docs) {
105
+ return;
106
+ }
107
+ const query = docs.api.sanitizeSearchDocsQuery(term);
108
+ if (!query) {
109
+ return fail(`The search term '${term}' is not valid.`);
110
+ }
111
+ let found;
112
+ try {
113
+ found = yield docs.provider.searchDocEntries(framework, query);
114
+ }
115
+ catch (error) {
116
+ return fail(`The search for '${term}' failed: ${error.message}` + "\n" + OPEN_HINT);
117
+ }
118
+ const results = found.slice(0, Math.min(limit, MAX_RESULTS));
119
+ if (!results.length) {
120
+ return cli_core_1.Util.log(`No results found for "${term}" in the ${framework} docs. ` + OPEN_HINT);
121
+ }
122
+ cli_core_1.Util.log((0, doc_format_1.formatSearchResults)(results, term, framework));
123
+ });
124
+ }
125
+ function readDoc(argv) {
126
+ return __awaiter(this, void 0, void 0, function* () {
127
+ const name = argv.read.trim();
128
+ const framework = yield resolveFramework(requestedFramework(argv));
129
+ if (!framework) {
130
+ return;
131
+ }
132
+ const docs = yield getProvider();
133
+ if (!docs) {
134
+ return;
135
+ }
136
+ const result = yield docs.api.resolveDoc(docs.provider, framework, name);
137
+ if (!result.found) {
138
+ return fail(`Doc "${name}" not found in the ${framework} docs. ` +
139
+ `Run "ig doc <term>" to list doc names.`);
140
+ }
141
+ if (result.fuzzy) {
142
+ cli_core_1.Util.warn(`No doc is named "${name}"; showing the closest match, "${result.servedName}".`, "yellow");
143
+ }
144
+ cli_core_1.Util.log((0, doc_format_1.formatDoc)(result.text));
145
+ });
146
+ }
147
+ function openInBrowser(term) {
148
+ return __awaiter(this, void 0, void 0, function* () {
149
+ cli_core_1.Util.log(`Review your search results in the browser`, "green");
150
+ yield doc.open(`https://www.infragistics.com/search?q=${encodeURIComponent(term.trim())}`);
151
+ });
152
+ }
37
153
  const doc = {
38
154
  command: "doc [term]",
39
- describe: "Opens the Infragistics search for the given term",
155
+ describe: "Searches the Ignite UI docs for the given term",
40
156
  builder: (yargs) => {
41
157
  return yargs
42
158
  .positional("term", {
43
159
  describe: "Term to search for",
44
160
  type: "string"
161
+ })
162
+ .option("open", {
163
+ alias: "o",
164
+ describe: "Open the Infragistics website search in the browser",
165
+ type: "boolean"
166
+ })
167
+ .option("read", {
168
+ describe: "Print a doc by the name listed in the search results",
169
+ type: "string",
170
+ requiresArg: true
171
+ })
172
+ .option("framework", {
173
+ alias: "f",
174
+ describe: "Framework docs to search (detected from the project by default)",
175
+ choices: DOC_FRAMEWORKS.map(x => x.value),
176
+ type: "string"
177
+ })
178
+ .option("limit", {
179
+ describe: `Number of results to print, up to ${MAX_RESULTS}`,
180
+ type: "number",
181
+ default: DEFAULT_RESULTS
45
182
  });
46
183
  },
47
184
  open: (target) => __awaiter(void 0, void 0, void 0, function* () {
48
185
  const open = yield Promise.resolve().then(() => __importStar(require("open")));
49
186
  yield open.default(target);
50
187
  }),
188
+ loadDocs: () => __awaiter(void 0, void 0, void 0, function* () {
189
+ // tsc turns import() into require() here, which older Node versions refuse for an ESM package
190
+ const entry = (0, url_1.pathToFileURL)(require.resolve("@igniteui/mcp-server/docs")).href;
191
+ // eslint-disable-next-line no-new-func
192
+ return new Function("specifier", "return import(specifier)")(entry);
193
+ }),
51
194
  handler(argv) {
52
195
  return __awaiter(this, void 0, void 0, function* () {
53
196
  cli_core_1.GoogleAnalytics.post({
54
197
  t: "screenview",
55
198
  cd: "Doc"
56
199
  });
200
+ if (argv.read) {
201
+ cli_core_1.GoogleAnalytics.post({
202
+ t: "event",
203
+ ec: "$ig doc",
204
+ ea: `doc to read: ${argv.read}`
205
+ });
206
+ return readDoc(argv);
207
+ }
57
208
  if (!argv.term) {
58
209
  const answer = yield PromptSession_1.PromptSession.chooseTerm();
59
210
  argv.term = answer;
60
- yield doc.handler(argv);
211
+ return doc.handler(argv);
61
212
  }
62
- else if (!cli_core_1.Util.isAlphanumericExt(argv.term)) {
63
- return cli_core_1.Util.error(`The search term '${argv.term}' is not valid.` + "\n" +
64
- "Name should start with a letter and can also contain numbers, dashes and spaces.", "red");
213
+ const requested = requestedFramework(argv);
214
+ const detected = argv.framework ? null : requested;
215
+ const noBundledDocs = !!detected && !DOC_FRAMEWORKS.some(x => x.value === detected);
216
+ if ((argv.open || noBundledDocs) && !cli_core_1.Util.isAlphanumericExt(argv.term)) {
217
+ return fail(`The search term '${argv.term}' is not valid.` + "\n" +
218
+ "Name should start with a letter and can also contain numbers, dashes and spaces.");
65
219
  }
66
- else {
67
- cli_core_1.Util.log(`Review your search results in the browser`, "green");
68
- cli_core_1.GoogleAnalytics.post({
69
- t: "event",
70
- ec: "$ig doc",
71
- ea: `term to search: ${argv.term}`,
72
- cd13: argv.term
73
- });
74
- yield doc.open(`https://www.infragistics.com/search?q=${argv.term.trim()}`);
220
+ cli_core_1.GoogleAnalytics.post({
221
+ t: "event",
222
+ ec: "$ig doc",
223
+ ea: `term to search: ${argv.term}`,
224
+ cd13: argv.term
225
+ });
226
+ if (argv.open) {
227
+ return openInBrowser(argv.term);
228
+ }
229
+ if (noBundledDocs) {
230
+ cli_core_1.Util.log(`There are no bundled docs for ${detected}, searching the Infragistics website instead.`);
231
+ return openInBrowser(argv.term);
75
232
  }
233
+ return searchLocal(argv, requested);
76
234
  });
77
235
  }
78
236
  };
@@ -0,0 +1,3 @@
1
+ import { CommandType } from "./types";
2
+ declare const command: CommandType;
3
+ export default command;
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const cli_core_1 = require("@igniteui/cli-core");
13
+ const doctor_1 = require("../doctor");
14
+ const command = {
15
+ command: "doctor",
16
+ describe: "Checks the environment and the current project for common problems",
17
+ builder: (yargs) => {
18
+ return yargs
19
+ .option("json", {
20
+ describe: "Print the results as JSON",
21
+ type: "boolean",
22
+ default: false
23
+ })
24
+ .option("offline", {
25
+ describe: "Skip the checks that need the network",
26
+ type: "boolean",
27
+ default: false
28
+ });
29
+ },
30
+ handler(argv) {
31
+ return __awaiter(this, void 0, void 0, function* () {
32
+ if (!argv.offline) {
33
+ try {
34
+ cli_core_1.GoogleAnalytics.post({
35
+ t: "screenview",
36
+ cd: "Doctor"
37
+ });
38
+ }
39
+ catch ( /* reads the config and runs npm, either of which the checks may report as broken */_a) { /* reads the config and runs npm, either of which the checks may report as broken */ }
40
+ }
41
+ const results = yield (0, doctor_1.runDoctor)(!!argv.offline);
42
+ cli_core_1.Util.log(argv.json ? (0, doctor_1.formatJson)(results) : (0, doctor_1.formatText)(results));
43
+ if ((0, doctor_1.summarize)(results).fail > 0) {
44
+ process.exitCode = 1;
45
+ }
46
+ });
47
+ }
48
+ };
49
+ exports.default = command;
@@ -3,6 +3,7 @@ export { default as aiConfig } from "./ai-config";
3
3
  export { default as build } from "./build";
4
4
  export { default as config } from "./config";
5
5
  export { default as doc } from "./doc";
6
+ export { default as doctor } from "./doctor";
6
7
  export { default as generate } from "./generate";
7
8
  export { default as list } from "./list";
8
9
  export { default as mcp } from "./mcp";
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.upgrade = exports.test = exports.start = exports.newCommand = exports.mcp = exports.list = exports.generate = exports.doc = exports.config = exports.build = exports.aiConfig = exports.add = void 0;
20
+ exports.upgrade = exports.test = exports.start = exports.newCommand = exports.mcp = exports.list = exports.generate = exports.doctor = exports.doc = exports.config = exports.build = exports.aiConfig = exports.add = void 0;
21
21
  var add_1 = require("./add");
22
22
  Object.defineProperty(exports, "add", { enumerable: true, get: function () { return __importDefault(add_1).default; } });
23
23
  var ai_config_1 = require("./ai-config");
@@ -28,6 +28,8 @@ var config_1 = require("./config");
28
28
  Object.defineProperty(exports, "config", { enumerable: true, get: function () { return __importDefault(config_1).default; } });
29
29
  var doc_1 = require("./doc");
30
30
  Object.defineProperty(exports, "doc", { enumerable: true, get: function () { return __importDefault(doc_1).default; } });
31
+ var doctor_1 = require("./doctor");
32
+ Object.defineProperty(exports, "doctor", { enumerable: true, get: function () { return __importDefault(doctor_1).default; } });
31
33
  var generate_1 = require("./generate");
32
34
  Object.defineProperty(exports, "generate", { enumerable: true, get: function () { return __importDefault(generate_1).default; } });
33
35
  var list_1 = require("./list");
@@ -25,6 +25,16 @@ export interface PositionalArgs {
25
25
  global?: boolean;
26
26
  /** The term to search for. */
27
27
  term?: string;
28
+ /** Opens the search in the browser instead of printing results. */
29
+ open?: boolean;
30
+ /** Name of a doc to print in full. */
31
+ read?: string;
32
+ /** Maximum number of search results to print. */
33
+ limit?: number;
34
+ /** Prints the doctor results as JSON. */
35
+ json?: boolean;
36
+ /** Skips the doctor checks that need the network. */
37
+ offline?: boolean;
28
38
  /** Executes end-to-end tests. */
29
39
  e2e?: boolean;
30
40
  }
@@ -60,9 +70,38 @@ export interface ConfigCommandType extends CommandType {
60
70
  /** Adds a value to an existing configuration array. */
61
71
  addHandler(argv: ArgumentsCamelCase<PositionalArgs>): void;
62
72
  }
73
+ export interface DocSearchEntry {
74
+ title: string;
75
+ name: string;
76
+ summary?: string;
77
+ /** Hits sit between `>>>` and `<<<`. */
78
+ excerpt?: string;
79
+ }
80
+ export interface DocsProvider {
81
+ init(): Promise<void>;
82
+ searchDocEntries(framework: string, query: string): Promise<DocSearchEntry[]>;
83
+ getDoc(framework: string, name: string): Promise<{
84
+ text: string;
85
+ found: boolean;
86
+ }>;
87
+ }
88
+ /** The `@igniteui/mcp-server/docs` entry. */
89
+ export interface DocsApi {
90
+ LocalDocsProvider: new () => DocsProvider;
91
+ sanitizeSearchDocsQuery(queryText: string): string | null;
92
+ /** Finds a doc by its name, a component class name or the closest match (`fuzzy`). */
93
+ resolveDoc(provider: DocsProvider, framework: string, name: string): Promise<{
94
+ text: string;
95
+ found: boolean;
96
+ servedName: string;
97
+ fuzzy: boolean;
98
+ }>;
99
+ }
63
100
  export interface DocCommandType extends CommandType {
64
101
  /** Uses the `open` package to open a URL, file etc. */
65
102
  open(target: string): void;
103
+ /** Loads the docs database access bundled with the MCP server package. */
104
+ loadDocs(): Promise<DocsApi>;
66
105
  }
67
106
  export interface TestCommandType extends CommandType {
68
107
  /** Executes tests. */
@@ -0,0 +1,4 @@
1
+ import { DocSearchEntry } from "./commands/types";
2
+ export declare function formatSearchResults(results: DocSearchEntry[], term: string, framework: string): string;
3
+ /** Drops what only an MCP client can use: the frontmatter and the `mcp:` link targets. */
4
+ export declare function formatDoc(text: string): string;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatSearchResults = formatSearchResults;
4
+ exports.formatDoc = formatDoc;
5
+ const cli_core_1 = require("@igniteui/cli-core");
6
+ const HIT = />>>([\s\S]*?)<<</g;
7
+ function formatSearchResults(results, term, framework) {
8
+ const lines = [`Found ${results.length} result${results.length === 1 ? "" : "s"} for "${term}" in the ${framework} docs:`, ""];
9
+ results.forEach((result, index) => {
10
+ var _a, _b;
11
+ const indent = " ".repeat(String(index + 1).length + 2);
12
+ lines.push(`${index + 1}. ${cli_core_1.Util.style(result.title, "bold")} ${cli_core_1.Util.style(result.name, "cyan")}`);
13
+ if ((_a = result.summary) === null || _a === void 0 ? void 0 : _a.trim()) {
14
+ lines.push(indent + result.summary.replace(/\s+/g, " ").trim());
15
+ }
16
+ // an excerpt keeps the line breaks of the doc it was cut from
17
+ const excerpt = (_b = result.excerpt) === null || _b === void 0 ? void 0 : _b.replace(/\s+/g, " ").trim();
18
+ if (excerpt) {
19
+ lines.push(indent + cli_core_1.Util.style("> ", "dim") + excerpt.replace(HIT, (_match, hit) => cli_core_1.Util.style(hit, "yellow")));
20
+ }
21
+ lines.push("");
22
+ });
23
+ lines.push(`Read a result: ig doc --read <name> --framework ${framework}`);
24
+ lines.push(`Search the website: ig doc ${cli_core_1.Util.quoteIfNeeded(term)} --open`);
25
+ return lines.join("\n");
26
+ }
27
+ /** Drops what only an MCP client can use: the frontmatter and the `mcp:` link targets. */
28
+ function formatDoc(text) {
29
+ return text
30
+ .replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/, "")
31
+ .replace(/\[([^\]]+)\]\(mcp:[^)]*\)/g, "$1")
32
+ .trim();
33
+ }
@@ -0,0 +1,6 @@
1
+ import { CheckResult, DoctorContext } from "./types";
2
+ export declare function checkBundledServer(context: DoctorContext): Promise<CheckResult>;
3
+ export declare function checkMcpConfig(): CheckResult;
4
+ export declare function checkInstructions(): CheckResult;
5
+ export declare function checkSkills(): CheckResult;
6
+ export declare function aiChecks(context: DoctorContext): Promise<CheckResult[]>;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.checkBundledServer = checkBundledServer;
16
+ exports.checkMcpConfig = checkMcpConfig;
17
+ exports.checkInstructions = checkInstructions;
18
+ exports.checkSkills = checkSkills;
19
+ exports.aiChecks = aiChecks;
20
+ const cli_core_1 = require("@igniteui/cli-core");
21
+ const doc_1 = __importDefault(require("../commands/doc"));
22
+ const mcp_1 = require("../commands/mcp");
23
+ const GROUP = "AI setup";
24
+ const AI_CONFIG_FIX = "Run: ig ai-config";
25
+ function checkBundledServer(context) {
26
+ return __awaiter(this, void 0, void 0, function* () {
27
+ const id = "mcp-server";
28
+ const fix = "Reinstall igniteui-cli";
29
+ if (!(0, mcp_1.resolveMcpServerEntry)(context.cliDir)) {
30
+ return { id, group: GROUP, status: "fail", detail: "The bundled MCP server was not found", fix };
31
+ }
32
+ try {
33
+ const api = yield doc_1.default.loadDocs();
34
+ yield new api.LocalDocsProvider().init();
35
+ }
36
+ catch (error) {
37
+ return {
38
+ id, group: GROUP, status: "fail",
39
+ detail: `The bundled docs database can't be opened: ${error.message}`, fix
40
+ };
41
+ }
42
+ return { id, group: GROUP, status: "ok", detail: "Bundled MCP server found and docs database opens" };
43
+ });
44
+ }
45
+ function checkMcpConfig() {
46
+ const id = "mcp-config";
47
+ const configs = (0, cli_core_1.getMcpConfigStatus)();
48
+ if (!configs.length) {
49
+ return { id, group: GROUP, status: "warn", detail: "No MCP configuration file found", fix: AI_CONFIG_FIX };
50
+ }
51
+ const complete = configs.filter(x => !x.missingServers.length);
52
+ if (!complete.length) {
53
+ const invalid = configs.filter(x => x.invalid);
54
+ return {
55
+ id, group: GROUP, status: "warn",
56
+ detail: configs
57
+ .map(x => x.invalid ? `${x.mcpFilePath} is not valid JSON` : `${x.mcpFilePath} lacks ${x.missingServers.join(", ")}`)
58
+ .join("; "),
59
+ fix: invalid.length ? `Fix the JSON in ${invalid.map(x => x.mcpFilePath).join(", ")}` : AI_CONFIG_FIX
60
+ };
61
+ }
62
+ return {
63
+ id, group: GROUP, status: "ok",
64
+ detail: `Ignite UI MCP servers configured in ${complete.map(x => x.mcpFilePath).join(", ")}`
65
+ };
66
+ }
67
+ function checkInstructions() {
68
+ const fileSystem = cli_core_1.App.container.get(cli_core_1.FS_TOKEN);
69
+ const found = cli_core_1.AI_AGENT_CHOICES.map(cli_core_1.getInstructionFilePath).filter(file => fileSystem.fileExists(file));
70
+ return found.length
71
+ ? { id: "ai-instructions", group: GROUP, status: "ok", detail: `Instructions: ${found.join(", ")}` }
72
+ : { id: "ai-instructions", group: GROUP, status: "warn", detail: "No agent instruction file found", fix: AI_CONFIG_FIX };
73
+ }
74
+ function checkSkills() {
75
+ const fileSystem = cli_core_1.App.container.get(cli_core_1.FS_TOKEN);
76
+ const found = cli_core_1.AI_AGENT_CHOICES.map(cli_core_1.getSkillsDir).filter(dir => fileSystem.directoryExists(dir));
77
+ return found.length
78
+ ? { id: "ai-skills", group: GROUP, status: "ok", detail: `Skills: ${found.join(", ")}` }
79
+ : { id: "ai-skills", group: GROUP, status: "warn", detail: "No agent skills folder found", fix: AI_CONFIG_FIX };
80
+ }
81
+ function aiChecks(context) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const results = [yield checkBundledServer(context)];
84
+ if (!context.inProject) {
85
+ results.push({ id: "ai-project", group: GROUP, status: "skip", detail: "Not in an Ignite UI project" });
86
+ }
87
+ else if (context.framework === "jquery") {
88
+ results.push({ id: "ai-project", group: GROUP, status: "skip", detail: "Not available for jQuery projects" });
89
+ }
90
+ else {
91
+ results.push(checkMcpConfig(), checkInstructions(), checkSkills());
92
+ }
93
+ return results;
94
+ });
95
+ }
@@ -0,0 +1,7 @@
1
+ import { CheckResult, DoctorContext } from "./types";
2
+ export declare function checkNode(version?: string): CheckResult;
3
+ export declare function checkNpm(): Promise<CheckResult>;
4
+ export declare function checkGit(): Promise<CheckResult>;
5
+ export declare function checkDotnet(): Promise<CheckResult>;
6
+ export declare function checkCliVersion(context: DoctorContext): Promise<CheckResult>;
7
+ export declare function environmentChecks(context: DoctorContext): Promise<CheckResult[]>;