reindex_file_impl
Re-parse a single source file after edits to update its symbols in the C/C++ index, avoiding a full rebuild.
Instructions
Re-parse a single source file with libclang and update its symbols in the index.
Not read-only — uses the exact compiler flags from compile_commands.json.
Use after editing a file to keep the index current without a full rebuild.
A source file must be listed in compile_commands.json. A header is
not listed there — compile_commands.json names translation units — so it
is re-parsed through one unit that includes it, taken from the manifest.
That answer describes a single compilation context, thus the result
carries a warning: another unit can see the header under a different
set of #define values and still hold stale symbols. Only a full
fw-context index covers every context. One unit and not all of them
is a cost decision — an application header reaches a median of 3 units
but as many as 266 on a real project, at tens of seconds each.
Also regenerates LLM analysis and method override relationships for
affected symbols when with_analysis=True. The analysis is
content-addressed, thus an unchanged symbol is never re-analysed.
Args: file_path: Path to the file to re-parse. A source file must be in compile_commands.json; a header goes through one including unit. project_root: Project root directory. Auto-detected if omitted. project: Project name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both. with_analysis: When True (default), also regenerates LLM symbol analysis, method override relationships, PageRank, and embeddings. Set False for a fast symbol-only update (used by background auto-reindex).
Returns: dict: {file, translation_units, symbols_updated, elapsed_s, analysis_updated (if LLM enabled with analysis), or error}.
On failure the dict holds only ``error`` with the reason.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project | No | Project name or project_id — call list_projects to get them. Use it to ask about a project that is not the project of the current directory. It is an alternative to project_root, which takes a root path. Give one of the two, not both. | |
| file_path | Yes | Absolute or project-relative path to the file to re-parse. A source file must have an entry in compile_commands.json. A header is re-parsed through one translation unit that includes it, and the result then carries a warning that other units can still hold stale symbols. | |
| project_root | No | Project root directory. Auto-detected from cwd if omitted. This field also accepts a project name or a project_id, but project is the clear field for those. | |
| with_analysis | No | When True (default), also regenerates LLM symbol analysis and method override relationships — slower but produces a fully up-to-date index. Set False for a fast symbol-only update (used by background auto-reindex). |