conductor(checkpoint): Checkpoint end of Phase 1 (Directory Migration)

This commit is contained in:
2026-05-07 21:37:58 -04:00
parent 49acb884e1
commit 2065dd8559
119 changed files with 3 additions and 3 deletions
@@ -0,0 +1,16 @@
{
"track_id": "ts_cpp_tree_sitter_20260308",
"title": "Tree-Sitter C/C++ MCP Tools",
"status": "pending",
"created": "2026-03-08",
"priority": "high",
"owner": "tier2-tech-lead",
"description": "Add tree-sitter-based C and C++ parsing to mcp_client with skeleton and outline tools (ts_c_*, ts_cpp_*)",
"dependencies": [],
"out_of_scope": [
"Cross-file symbol resolution",
"gencpp integration",
"Template instantiation analysis",
"Macro expansion"
]
}
@@ -0,0 +1,68 @@
# Plan: Tree-Sitter C/C++ MCP Tools
## Overview
Add tree-sitter-based C and C++ parsing to mcp_client with skeleton and outline tools.
## Phase 1: Dependencies [checkpoint: 1f86c62]
Focus: Add tree-sitter C/C++ grammars
- [x] Task 1.1: Add tree-sitter-c and tree-sitter-cpp to pyproject.toml 568c549
- WHERE: pyproject.toml:16-17
- WHAT: Add `"tree-sitter-c>=0.23.0", "tree-sitter-cpp>=0.3.0"` to dependencies
- HOW: Edit dependencies array
- SAFETY: No breaking changes
## Phase 2: ASTParser Extensions [checkpoint: 7bc4642]
Focus: Extend ASTParser to support C/C++ languages
- [x] Task 2.1: Modify ASTParser.__init__ to accept "c" and "cpp" languages c025ebc
- WHERE: src/file_cache.py:22-28
- WHAT: Add language loading for tree-sitter-c and tree-sitter-cpp
- HOW: Import tree_sitter_c, tree_sitter_cpp; load Language(tree_sitter_c.language()) etc.
- SAFETY: Maintain existing Python support
- [x] Task 2.2: Implement C skeleton extraction d3cd7cf
- [x] Task 2.3: Implement C++ skeleton extraction d3cd7cf
- [x] Task 2.4: Implement code outline for C and C++ d3cd7cf
## Phase 3: MCP Tool Integration
Focus: Add tools to mcp_client dispatch
- [x] Task 3.1: Add ts_c_get_skeleton tool 0db41ef
- [x] Task 3.2: Add ts_cpp_get_skeleton tool 0db41ef
- [x] Task 3.3: Add ts_c_get_code_outline tool 0db41ef
- [x] Task 3.4: Add ts_cpp_get_code_outline tool 0db41ef
- [x] Task 3.5: Register tools in get_tool_schemas 0db41ef
## Phase 4: Tests [checkpoint: 4f08677]
Focus: Verify C/C++ tools work correctly
- [x] Task 4.1: Write tests for ts_c_get_skeleton 3bb850a
- [x] Task 4.2: Write tests for ts_cpp_get_skeleton 3bb850a
- [x] Task 4.3: Write tests for code outline tools 3bb850a
- [x] Task 4.4: Integration test - verify tools dispatch correctly 3bb850a
## Phase 5: Parity with Python Tools [checkpoint: 2e43b45]
Focus: Implement definitions, signatures, and update tools
- [x] Task 5.1: Implement get_definition for C and C++ 799feb0
- [x] Task 5.2: Implement get_signature for C and C++ 799feb0
- [x] Task 5.3: Implement update_definition for C and C++ 8642d89
- WHERE: src/mcp_client.py
- WHAT: Implement `ts_c_update_definition` and `ts_cpp_update_definition`
- HOW: Use AST to find target range; surgically replace lines in file
- SAFETY: Verify AST still parses after edit (optional but recommended)
- [x] Task 5.4: Register Phase 5 tools in dispatch and schema 4e8b397
- WHERE: src/mcp_client.py
- WHAT: Add tools to `get_tool_schemas` and `dispatch`
- HOW: Standard registration pattern
## Phase 6: Robust Testing with gencpp [checkpoint: 992e206]
Focus: Verify against real-world C++ components
- [x] Task 6.1: Define test corpus from gencpp samples 992e206
- [x] Task 6.2: Run exhaustive skeleton/outline tests on gencpp corpus 992e206
- [x] Task 6.3: Verify surgical updates on gencpp components 992e206
- [x] Task 6.4: Final audit and track closure 992e206
@@ -0,0 +1,82 @@
# Track Specification: Tree-Sitter C/C++ MCP Tools
## Overview
Add tree-sitter-based C and C++ parsing support to the MCP client, providing skeleton and outline tools for C/C++ codebases. Tools will be prefixed `ts_c_` and `ts_cpp_` to distinguish from existing Python tools and leave namespace open for future gencpp integration.
## Current State Audit (as of 08e003a)
### Already Implemented
- `src/file_cache.py`: ASTParser class with tree-sitter-python support
- `src/mcp_client.py`: 26 MCP tools (all Python-prefixed: `py_get_skeleton`, `py_get_definition`, etc.)
- `pyproject.toml`: tree-sitter>=0.25.2 and tree-sitter-python>=0.25.0 already listed
- Existing pattern: `get_skeleton()`, `get_code_outline()` methods extract functions, classes, docstrings
### Gaps to Fill (This Track's Scope)
- No C/C++ tree-sitter grammars installed
- No C/C++ parsing logic in ASTParser
- No MCP tools for C/C++ code extraction
- No MCP tools for C/C++ code modification (Parity with Python `py_update_definition`)
## Goals
1. Add tree-sitter-c and tree-sitter-cpp dependencies
2. Extend ASTParser to support C and C++ languages
3. Implement skeleton and outline generation for C/C++ (functions, structs, enums, classes)
4. Add MCP tools: `ts_c_get_skeleton`, `ts_cpp_get_skeleton`, `ts_c_get_code_outline`, `ts_cpp_get_code_outline`
5. Implement definition, signature, and update tools for C/C++ parity
6. Register tools in mcp_client dispatch
7. Validate tools against real-world C++ components from `gencpp` repository
## Functional Requirements
### Dependencies
- Add `tree-sitter-c` to pyproject.toml
- Add `tree-sitter-cpp` to pyproject.toml
### ASTParser Extensions
- Modify `ASTParser.__init__` to accept "c", "cpp", "python" as valid languages
- Load appropriate tree-sitter language grammar based on parameter
- Reuse existing caching mechanism (`get_cached_tree`)
- Implement C-specific node types: `function_definition`, `struct_specifier`, `enum_specifier`, `typedef`
- Implement C++-specific node types: all C types plus `class_specifier`, `access_specifier`, `template_declaration`
### MCP Tools
| Tool Name | Description |
|-----------|-------------|
| `ts_c_get_skeleton` | Returns C file skeleton (function signatures, struct/union/enum definitions) |
| `ts_cpp_get_skeleton` | Returns C++ file skeleton (above + class methods, templates, namespaces) |
| `ts_c_get_code_outline` | Returns hierarchical C outline (functions, structs, enums, globals with line ranges) |
| `ts_cpp_get_code_outline` | Returns hierarchical C++ outline (above + classes, templates, namespaces) |
| `ts_c_get_definition` | Get full source code of a specific C function or struct |
| `ts_cpp_get_definition` | Get full source code of a specific C++ class, function, or method |
| `ts_c_get_signature` | Get only the signature part of a C function |
| `ts_cpp_get_signature` | Get only the signature part of a C++ function or method |
| `ts_c_update_definition` | Surgically replace the definition of a C function or struct |
| `ts_cpp_update_definition` | Surgically replace the definition of a C++ class, function, or method |
### Tool Output Format
Match existing Python tool formats for consistency:
- Skeleton: signatures + docstrings, bodies replaced with `...`
- Outline: hierarchical list with `[Class] name (Lines X-Y)` format
- Definition: raw source code of the identified range
- Signature: code from start of definition until start of block/semicolon
## Non-Functional Requirements
- Follow existing 1-space indentation code style
- Use exact same patterns as existing Python tree-sitter implementation
- Maintain AST cache with mtime invalidation (reuse existing logic)
- Tools must pass allowlist check in mcp_client
## Architecture Reference
- **ASTParser pattern**: `src/file_cache.py:16-333` - existing tree-sitter integration
- **MCP tool dispatch**: `src/mcp_client.py:920-987` - tool registration and dispatch
- **Tool schema format**: `src/mcp_client.py:998-1000` - `get_tool_schemas()`
## Out of Scope
- Cross-file symbol resolution (AI uses search tools for this)
- Template instantiation analysis
- Macro expansion
- gencpp integration (orchestrating gencpp logic itself is a separate track)