64 lines
2.8 KiB
Markdown
64 lines
2.8 KiB
Markdown
---
|
|
name: lsp-cli
|
|
description: >-
|
|
MANDATORY for Chromium C/C++ semantic analysis and compiler diagnostics.
|
|
Activate before exact symbol, definition, caller, implementation,
|
|
inheritance, or call-stack analysis, and after every C/C++ edit. Diagnostics
|
|
for every modified C/C++ file must report zero errors before a build; report
|
|
and stop when the CLI, session, or diagnostics are unavailable.
|
|
---
|
|
|
|
# lsp-cli (C++ MCP CLI)
|
|
|
|
lsp-cli.py is a lightweight CLI front-end to the C++ MCP server. It connects
|
|
using the session cached in `.lsp-cli.json`. Use it for precise, index-backed
|
|
C++ symbol lookup in the large Chromium tree.
|
|
|
|
## Hard stops
|
|
|
|
Before semantic analysis or diagnostics, locate `lsp-cli.py` at the project
|
|
root or in this skill directory. If it is missing, report that exact condition
|
|
and STOP.
|
|
|
|
The cached `.lsp-cli.json` session and its endpoint must be usable. If the
|
|
file is missing, its endpoint is unavailable, or a CLI command exits non-zero,
|
|
report the command and complete failure output, then STOP. Do not guess an
|
|
endpoint, try an alternate endpoint, or create or replace a session cache
|
|
without a new user instruction.
|
|
|
|
## Required diagnostic gate
|
|
|
|
After every C/C++ source or header edit, run diagnostics for every modified
|
|
file before starting a build:
|
|
|
|
```sh
|
|
./lsp-cli.py show-diagnostics path/to/modified/file1.cc path/to/modified/file2.h
|
|
```
|
|
|
|
Report all errors and warnings. Zero errors is required to proceed to a build.
|
|
If diagnostics report any error, cannot cover every modified file, or fail to
|
|
run, report the result and STOP. Do not build, retry, or substitute another
|
|
compiler-diagnostic command until the user gives a new instruction.
|
|
|
|
## How to get more information
|
|
```sh
|
|
./lsp-cli.py --help # to get available arguments and examples
|
|
./lsp-cli.py search-symbols --help #Help on how to search for C++ symbols in the codebase
|
|
./lsp-cli.py search-class --help #Help on how to search for C++ classes/structs/interfaces (kinds: Class, Struct, Interface)
|
|
./lsp-cli.py search-method --help #Help on how to search for C++ methods/functions/constructors (kinds: Method, Function, Constructor)
|
|
./lsp-cli.py analyze-symbol --help #Help on how to perform comprehensive analysis of a C++ symbol
|
|
./lsp-cli.py get-project-details --help #Help on how to get comprehensive project analysis including build configurations and global compilation database
|
|
./lsp-cli.py show-diagnostics --help #Help on how to show clangd diagnostics (errors/warnings/notes) for a source file
|
|
```
|
|
`--build-directory` should be inherited from running server (no need to specify explicitly in normal usage)
|
|
|
|
### Possible CLI locations
|
|
|
|
- Project root
|
|
- skill directory
|
|
|
|
## Why use lsp-cli.py
|
|
|
|
The clangd index resolves qualified names and overloads reliably for the active
|
|
build configuration, yielding exact definitions and call sites.
|