-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Expand file tree
/
Copy pathai-tutor.ts
More file actions
40 lines (34 loc) · 1.02 KB
/
ai-tutor.ts
File metadata and controls
40 lines (34 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { chdir } from 'node:process';
import { exec, ProcessOutput, silentNpm } from '../../utils/process';
import assert from 'node:assert/strict';
const MCP_INSPECTOR_PACKAGE_NAME = '@modelcontextprotocol/inspector-cli';
const MCP_INSPECTOR_PACKAGE_VERSION = '0.16.2';
const MCP_INSPECTOR_COMMAND_NAME = 'mcp-inspector-cli';
async function runInspector(...args: string[]): Promise<ProcessOutput> {
const result = await exec(
MCP_INSPECTOR_COMMAND_NAME,
'--cli',
'npx',
'--no',
'@angular/cli',
'mcp',
...args,
);
return result;
}
export default async function () {
await silentNpm(
'install',
'--ignore-scripts',
'-g',
`${MCP_INSPECTOR_PACKAGE_NAME}@${MCP_INSPECTOR_PACKAGE_VERSION}`,
);
// Ensure `get_best_practices` returns the markdown content
const { stdout: stdoutInsideWorkspace } = await runInspector(
'--method',
'tools/call',
'--tool-name',
'ai_tutor',
);
assert.match(stdoutInsideWorkspace, /# `airules.md` - Modern Angular Tutor 🧑🏫/);
}