add-command
Skill1.7k starsChanged 7 months agoMITView on GitHub
Use when adding a new cmake.* command to CMake Tools. Touches package.json (contributes.commands), package.nls.json, src/extension.ts (funs array), and CHANGELOG.md. Triggers: "add command", "register command", "new command palette entry".
4 other projects use a version of this.
Trending
Quiet this year.thin dataabout the whole repository
Most recently taken up by
- leemour/max-clitheir own version, first seen Oct 3, 2026
- Doist/todoist-clitheir own version, first seen Apr 7, 2026
- Doist/twist-clitheir own version, first seen Apr 3, 2026
- ldayton/Dippytheir own version, first seen Mar 9, 2026
Who's talking about microsoft/vscode-cmake-tools
- clangd/vscode-clangd“support commands in settings”GitHub · Jun 27, 2020 · 17 reactions
- fredericbonnet/cmake-test-explorer“trigger BuildBeforeRun also by running a test in the testexplorer”GitHub · Mar 12, 2021 · 8 reactions
- twxs/vs.language.cmake“CMake Tools Extension & twxs.cmake extension”GitHub · Jan 29, 2024 · 5 reactions
- disroop/vs-code-conan“configuration provider for cpptools / IntelliSense”GitHub · Jan 14, 2021 · 3 reactions
- microsoft/vscode-cmake-tools-api“Update APIs”GitHub · Aug 1, 2025 · 2 reactions
The biggest 5 of 14 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 14
Talked about on GitHub (14 times).
On GitHub · 14
- Jun 27, 2020support commands in settings — clangd/vscode-clangd17 reactions · 8 comments
- Mar 12, 2021trigger BuildBeforeRun also by running a test in the testexplorer — fredericbonnet/cmake-test-explorer8 reactions
- Jan 29, 2024CMake Tools Extension & twxs.cmake extension — twxs/vs.language.cmake5 reactions · 1 comment
- Jan 14, 2021configuration provider for cpptools / IntelliSense — disroop/vs-code-conan3 reactions · 5 comments
- Aug 1, 2025Update APIs — microsoft/vscode-cmake-tools-api2 reactions · 4 comments
9 more on GitHub
- Nov 15, 2024Add C++26 support (setting values only) — microsoft/vscode-cpptools2 reactions · 3 comments
- Oct 25, 2024cmake-kits.json incorrect CXX compiler — raspberrypi/pico-vscode2 reactions · 3 comments
- Oct 24, 2024Add support for `${command:<name-of-command>}` in c_cpp_properties.json — microsoft/vscode-cpptools2 reactions · 7 comments
- Feb 28, 2022Add support for resolving commands — microsoft/vscode-cpptools2 reactions · 4 comments
- Jun 19, 2025Cleanup standard version handling. — microsoft/vscode-makefile-tools1 reaction
- Mar 5, 2025Pixi builds / VSCode / CMake issues and differences — FreeCAD/FreeCAD1 reaction · 15 comments
- Jan 31, 2025Feature request: Improved variable and command substitution for build directories setting — JacquesLucke/gcov-viewer1 reaction
- Sep 26, 2024Replace CMake grammar — github-linguist/linguist1 reaction
- Sep 16, 2024Newest macos-latest environment update not working for VS Code tests — actions/runner-images1 reaction · 2 comments
Other versions4 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 4
- Doist/todoist-cli★ 316same name
- ldayton/Dippy★ 243same name
- leemour/max-cli★ 9same name
- Doist/twist-cli★ 3same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- .github/copilot-instructions.mdCopilot instructions
- add-diagnostic-parserSkill
- add-settingSkill
- backend-testsSkill
- presets-vs-kitsSkill
- pr-readinessSkill
- validation-projectSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 47
Add visibility rules for where the command appears.
- Very specific: line 103
Add the method name to the funs array (search for const funs: near the end of the file).
- Very specific: line 131
Add a method to the ExtensionManager class in src/extension.ts.
- Very specific: line 186
Add an entry under the current version in CHANGELOG.md, in the Features: section.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Adding a New Command
Recipe for adding a new cmake.* command to CMake Tools.
Files you must touch
| File | What to add |
package.json | Command declaration in contributes.commands + optional menu entries |
package.nls.json | English title string |
src/extension.ts | Method name in funs array + handler method on ExtensionManager |
CHANGELOG.md | Entry under the current version |
Step 1 — Declare the command in package.json
1a — contributes.commands
// package.json → contributes.commands
{
"command": "cmake.myCommand",
"title": "%cmake-tools.command.cmake.myCommand.title%",
"category": "CMake"
}Rules
- Command ID format:
cmake.<commandName>(camelCase). - Title: NLS key in the format
%cmake-tools.command.cmake.<commandName>.title%. - Category:
"CMake"— this prefixes the title in the Command Palette asCMake: <title>. when(optional): controls when the command appears in the Command Palette.icon(optional): Codicon reference like"$(settings-gear)"for tree-view inline buttons.
1b — contributes.menus (if needed)
Add visibility rules for where the command appears.
Command Palette visibility:
// package.json → contributes.menus.commandPalette
{
"command": "cmake.myCommand",
"when": "cmake:enableFullFeatureSet"
}Sidebar tree-view inline button:
// package.json → contributes.menus["view/item/context"]
{
"command": "cmake.projectStatus.myCommand",
"when": "view == cmake.projectStatus && cmake:enableFullFeatureSet && viewItem == 'myItem'",
"group": "inline"
}Common when clause patterns:
| Pattern | Meaning |
cmake:enableFullFeatureSet | Extension is fully activated |
useCMakePresets | Presets mode is active |
!useCMakePresets | Kits/variants mode is active |
view == cmake.projectStatus && viewItem == 'kit' | Specific tree-view item |
viewItem =~ /configPreset/ | Regex match on tree-view item |
Step 2 — Add the English string to package.nls.json
"cmake-tools.command.cmake.myCommand.title": "My Command Title"For titles containing the product name, use the object form with a translator comment:
"cmake-tools.command.cmake.myCommand.title": {
"message": "Do Something with CMake Tools",
"comment": ["The text 'CMake Tools' should not be localized."]
}Do not modify any file under
i18n/.
Step 3 — Register the command in src/extension.ts
Add the method name to the funs array (search for const funs: near the end of the file). The register() helper
auto-generates the command ID cmake.<name>, wraps it with debug logging, and hands
the promise to rollbar.takePromise() for error tracking.
// src/extension.ts
const funs: (keyof ExtensionManager)[] = [
// ... existing entries ...
'myCommand', // ← add here
];That's it — no manual registerCommand call needed. The loop that follows handles registration automatically:
for (const key of funs) {
context.subscriptions.push(register(key));
}Only use manual
vscode.commands.registerCommand()for commands that need custom argument handling (e.g., tree-view context-menu commands that receive a node argument). Most commands go through thefunsarray.
Step 4 — Implement the handler on ExtensionManager
Add a method to the ExtensionManager class in src/extension.ts. The method
name must match the string added to the funs array.
Pattern A — Delegate to CMakeProject (most common)
myCommand(folder?: vscode.WorkspaceFolder) {
telemetry.logEvent('myCommand');
return this.runCMakeCommand(
cmakeProject => cmakeProject.myCommand(),
folder,
undefined, // precheck (optional)
true // cleanOutputChannel
);
}Then implement the actual logic on CMakeProject in src/cmakeProject.ts.
Pattern B — Run for all projects
myCommandAll() {
telemetry.logEvent('myCommand', { all: 'true' });
return this.runCMakeCommandForAll(
cmakeProject => cmakeProject.myCommand()
);
}Pattern C — Direct implementation (no CMakeProject delegation)
async myCommand() {
telemetry.logEvent('myCommand');
const result = await vscode.window.showQuickPick(items);
if (!result) {
return;
}
// ... handle result ...
}Key helpers
| Helper | Use when |
this.runCMakeCommand(cmd, folder) | Single-project command |
this.runCMakeCommandForAll(cmd) | Runs on every open CMake project |
this.runCMakeCommandForProject(cmd, project) | Specific project instance |
Step 5 — Add a CHANGELOG entry
Add an entry under the current version in CHANGELOG.md, in the Features: section.
Verification checklist
package.json— command declared with NLS title and"CMake"categorypackage.json— menu entries added (if applicable) with correctwhenclausespackage.nls.json— English title string addedsrc/extension.ts— method name added tofunsarraysrc/extension.ts— handler method implemented onExtensionManager- Handler uses
telemetry.logEvent()for telemetry - Handler delegates to
CMakeProjectviarunCMakeCommand(if project-scoped) CHANGELOG.md— entry addedyarn compilesucceeds- No files under
i18n/were modified
See also: .github/copilot-instructions.md for project-wide conventions.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

