Skip to content

Commit b4efe78

Browse files
author
Hannia Valera
committed
feat: enhance onboarding tools with new concepts and documentation features
- Updated README.md to reflect new tool phases and descriptions. - Bump version to 0.2.0 in package.json. - Implemented new tools for concept explanation, source file finding, and documentation retrieval. - Added concepts data structure to provide detailed explanations of CMake Tools concepts. - Created a source map to link keywords to relevant source files in the codebase. - Developed a documentation map to connect topics with their respective documentation files. - Introduced new tools: `explain_concept`, `find_source_file`, and `get_docs_page` for improved onboarding experience.
1 parent d522e97 commit b4efe78

9 files changed

Lines changed: 928 additions & 7 deletions

File tree

tools/onboarding-mcp/README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ npm start
4343

4444
## Available tools
4545

46-
| Tool | Description |
47-
| --- | --- |
48-
| **`get_setup_guide`** | Returns an ordered list of setup steps for new contributors to build and run the extension locally. No inputs required. Each step includes a number, title, optional shell command, and optional notes. |
49-
| **`check_pr_readiness`** | Given a free-text description of changes (`{ "changes": "..." }`), returns a checklist of PR requirements from CONTRIBUTING.md. Each item includes the rule, a status (`"pass"`, `"warn"`, or `"manual_check_required"`), and a helpful hint. Items are flagged as `"warn"` when the description suggests a potential issue (e.g. mentioning `package.json` changes). |
46+
### Phase 1 — Setup & PR
47+
48+
| Tool | Input | Description |
49+
| --- | --- | --- |
50+
| **`get_setup_guide`** | _(none)_ | Returns an ordered list of setup steps for new contributors to build and run the extension locally. Each step includes a number, title, optional shell command, and optional notes. |
51+
| **`check_pr_readiness`** | `{ "changes": "..." }` | Given a free-text description of changes, returns a checklist of PR requirements from CONTRIBUTING.md. Each item includes the rule, a status (`"pass"`, `"warn"`, or `"manual_check_required"`), and a helpful hint. Items are flagged as `"warn"` when the description suggests a potential issue (e.g. mentioning `package.json` changes). |
52+
53+
### Phase 2 — Codebase Knowledge
54+
55+
| Tool | Input | Description |
56+
| --- | --- | --- |
57+
| **`explain_concept`** | `{ "concept": "..." }` | Explains a CMake Tools concept (e.g. `kit`, `preset`, `driver`, `ctest`, `build`, `configure`, `debug`, `settings`). Returns a summary, detailed explanation, related concepts, relevant source files, and a link to the docs page. If the concept is unknown, lists all known concepts. |
58+
| **`find_source_file`** | `{ "feature": "..." }` | Given a natural-language description (e.g. `"kit scanning"`, `"build logic"`, `"test runner"`), returns matching source files with GitHub links, descriptions, and relevance notes. Useful for quickly navigating to the right file. |
59+
| **`get_docs_page`** | `{ "topic": "..." }` | Given a topic (e.g. `presets`, `kits`, `debugging`, `troubleshooting`, `faq`), returns the matching documentation page with file path, GitHub URL, summary, and key section headings. |

tools/onboarding-mcp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cmake-tools-onboarding-mcp",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"private": true,
55
"description": "MCP server to help new contributors onboard to microsoft/vscode-cmake-tools",
66
"type": "module",

tools/onboarding-mcp/src/data/concepts.ts

Lines changed: 282 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
const GITHUB_BASE = "https://github.com/microsoft/vscode-cmake-tools/blob/main";
2+
3+
export interface DocsEntry {
4+
keywords: string[];
5+
file: string;
6+
githubUrl: string;
7+
summary: string;
8+
keyHeadings: string[];
9+
}
10+
11+
function doc(
12+
keywords: string[],
13+
file: string,
14+
summary: string,
15+
keyHeadings: string[]
16+
): DocsEntry {
17+
return {
18+
keywords,
19+
file,
20+
githubUrl: `${GITHUB_BASE}/${file}`,
21+
summary,
22+
keyHeadings
23+
};
24+
}
25+
26+
export const docsMap: DocsEntry[] = [
27+
doc(
28+
["kit", "kits", "compiler", "toolchain"],
29+
"docs/kits.md",
30+
"Documents how kits are found, defined, and configured — including user-local kits, project kits, and scan behavior.",
31+
["How kits are found and defined", "Kit options", "Specify a compiler", "Specify a toolchain", "Visual Studio"]
32+
),
33+
doc(
34+
["variant", "variants", "build type", "debug release", "cmake-variants"],
35+
"docs/variants.md",
36+
"Documents the cmake-variants.yaml schema and how variants apply build configurations like Debug/Release and shared/static linkage.",
37+
["Example YAML variants file", "Variant schema", "Variant settings", "Variant options", "How variants are applied"]
38+
),
39+
doc(
40+
["preset", "presets", "cmakepresets", "cmake presets"],
41+
"docs/cmake-presets.md",
42+
"Full reference for CMakePresets.json support including configure, build, test, package, and workflow presets.",
43+
[
44+
"Configure and build with CMake Presets",
45+
"Supported CMake and CMakePresets.json versions",
46+
"Enable CMakePresets.json",
47+
"Configure and build",
48+
"Add new presets",
49+
"Edit presets"
50+
]
51+
),
52+
doc(
53+
["settings", "config", "configuration", "cmake settings", "settings.json"],
54+
"docs/cmake-settings.md",
55+
"Reference for all cmake-tools settings in settings.json, including variable substitution and build problem matchers.",
56+
["CMake settings", "Variable substitution", "Environment variables", "Command substitution", "Additional build problem matchers"]
57+
),
58+
doc(
59+
["configure", "cmake configure", "configuration process"],
60+
"docs/configure.md",
61+
"Explains the CMake configure step — how it is triggered, what happens internally, clean configure, and CMake Debugger.",
62+
["The CMake Tools configure step", "The configure step outside of CMake Tools", "Clean configure", "Configure with CMake Debugger"]
63+
),
64+
doc(
65+
["build", "compile", "cmake build", "build target"],
66+
"docs/build.md",
67+
"Explains how to build the default target, a single target, build tasks, build flags, and clean build.",
68+
["Build the default target", "Build a single target", "Create a build task", "How CMake Tools builds", "Clean build"]
69+
),
70+
doc(
71+
["debug", "debugging", "launch", "debug target", "launch.json"],
72+
"docs/debug-launch.md",
73+
"Documents launch targets, quick debugging (no launch.json), launch.json integration for gdb/lldb/msvc, and debugging tests.",
74+
["Select a launch target", "Debugging without a launch.json", "Debug using a launch.json file", "Debugging tests", "Run without debugging"]
75+
),
76+
doc(
77+
["cmake debug", "cmake script debug", "cmake debugger", "cmakelist debug"],
78+
"docs/debug.md",
79+
"Documents debugging CMake scripts themselves (not the built binary) — stepping through CMakeLists.txt.",
80+
["Debugging from CMake Tools UI entry points", "Debugging from launch.json", "Example launch.json"]
81+
),
82+
doc(
83+
["troubleshoot", "troubleshooting", "error", "problem", "common issues"],
84+
"docs/troubleshoot.md",
85+
"Common issues and resolutions, logging levels, log file locations, and how to get help.",
86+
["Common Issues and Resolutions", "Increase the logging level", "Check the log file", "Get help"]
87+
),
88+
doc(
89+
["faq", "frequently asked", "questions", "help"],
90+
"docs/faq.md",
91+
"Frequently asked questions about CMake Tools — getting help, detecting VS Code, learning CMake, and common tasks.",
92+
["How can I get help?", "How can I detect when CMake is run from VS Code?", "How do I learn about CMake?", "How do I perform common tasks"]
93+
),
94+
doc(
95+
["task", "tasks", "tasks.json", "cmake task"],
96+
"docs/tasks.md",
97+
"Documents the VS Code task integration for CMake operations — configure, build, test, install, and clean tasks.",
98+
["Configure with CMake Tools tasks", "Build with CMake Tools tasks", "Test with CMake Tools tasks", "Install/Clean/Clean-rebuild with CMake Tools tasks"]
99+
),
100+
doc(
101+
["how to", "howto", "getting started", "quick start", "tutorial"],
102+
"docs/how-to.md",
103+
"Quick how-to guide for common operations — creating projects, configuring, building, debugging, and IntelliSense setup.",
104+
["Create a new project", "Configure a project", "Build a project", "Debug a project", "Set up include paths for C++ IntelliSense"]
105+
),
106+
doc(
107+
["options", "cmake options", "visibility", "status bar config"],
108+
"docs/cmake-options-configuration.md",
109+
"Documents CMake options visibility configuration — controlling which commands and status bar items are shown.",
110+
["Default Settings Json", "Configuring your CMake Status Bar and Project Status View"]
111+
)
112+
];
113+
114+
/** Get all known topic keywords for listing in error messages */
115+
export function knownTopics(): string[] {
116+
const topics = new Set<string>();
117+
for (const entry of docsMap) {
118+
for (const kw of entry.keywords) {
119+
topics.add(kw);
120+
}
121+
}
122+
return [...topics].sort();
123+
}
124+
125+
/**
126+
* Find the best matching docs entry for a topic string.
127+
* Returns entries sorted by keyword match count (best first).
128+
*/
129+
export function findDocsEntries(topic: string): DocsEntry[] {
130+
const inputWords = topic
131+
.toLowerCase()
132+
.split(/[\s,./\\]+/)
133+
.filter((w) => w.length > 1);
134+
135+
const inputPhrase = topic.toLowerCase().trim();
136+
137+
const scored = docsMap
138+
.map((entry) => {
139+
let score = 0;
140+
for (const keyword of entry.keywords) {
141+
if (inputPhrase.includes(keyword.toLowerCase())) {
142+
score += 2;
143+
} else {
144+
const keywordWords = keyword.toLowerCase().split(/\s+/);
145+
for (const kw of keywordWords) {
146+
if (inputWords.includes(kw)) {
147+
score += 1;
148+
}
149+
}
150+
}
151+
}
152+
return { entry, score };
153+
})
154+
.filter((e) => e.score > 0)
155+
.sort((a, b) => b.score - a.score)
156+
.map((e) => e.entry);
157+
158+
return scored;
159+
}

0 commit comments

Comments
 (0)