chore(conductor): Expand Tree-Sitter C/C++ track with new phases for tool parity and robust testing

This commit is contained in:
2026-05-05 19:31:25 -04:00
parent b0ed7026dc
commit b8460107b9
4 changed files with 80 additions and 6 deletions
@@ -41,3 +41,51 @@ Focus: Verify C/C++ tools work correctly
- [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
Focus: Implement definitions, signatures, and update tools
- [ ] Task 5.1: Implement get_definition for C and C++
- WHERE: src/file_cache.py, src/mcp_client.py
- WHAT: Implement `ts_c_get_definition` and `ts_cpp_get_definition`
- HOW: Use AST to find node by name; return source range
- SAFETY: Follow allowlist checks
- [ ] Task 5.2: Implement get_signature for C and C++
- WHERE: src/file_cache.py, src/mcp_client.py
- WHAT: Implement `ts_c_get_signature` and `ts_cpp_get_signature`
- HOW: Extract code from start of definition until block start (`{`) or semicolon (`;`)
- SAFETY: Handles multi-line signatures and templates
- [ ] Task 5.3: Implement update_definition for C and C++
- 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)
- [ ] Task 5.4: Register Phase 5 tools in dispatch and schema
- WHERE: src/mcp_client.py
- WHAT: Add tools to `get_tool_schemas` and `dispatch`
- HOW: Standard registration pattern
## Phase 6: Robust Testing with gencpp
Focus: Verify against real-world C++ components
- [ ] Task 6.1: Define test corpus from gencpp samples
- WHERE: tests/assets/gencpp_samples/
- WHAT: Collect complex C++ headers and implementations (templates, nested namespaces, multi-line macros)
- HOW: Copy selected files from gencpp repo into test assets
- [ ] Task 6.2: Run exhaustive skeleton/outline tests on gencpp corpus
- WHERE: tests/test_ts_cpp_tools.py
- WHAT: Verify no crashes and accurate extraction for complex C++ constructs
- HOW: Automated test loop over samples
- [ ] Task 6.3: Verify surgical updates on gencpp components
- WHERE: tests/test_ts_cpp_tools.py
- WHAT: Test `update_definition` on template methods and deeply nested classes
- HOW: Apply change, re-parse, verify integrity
- [ ] Task 6.4: Final audit and track closure
- WHERE: conductor/tracks.md
- WHAT: Mark track as completed and summarize results
@@ -16,6 +16,7 @@ Add tree-sitter-based C and C++ parsing support to the MCP client, providing ske
- 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
@@ -23,7 +24,9 @@ Add tree-sitter-based C and C++ parsing support to the MCP client, providing ske
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. Register tools in mcp_client dispatch
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
@@ -45,11 +48,19 @@ Add tree-sitter-based C and C++ parsing support to the MCP client, providing ske
| `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
@@ -68,5 +79,4 @@ Match existing Python tool formats for consistency:
- Cross-file symbol resolution (AI uses search tools for this)
- Template instantiation analysis
- Macro expansion
- gencpp integration (future separate track)
- Writing to C/C++ files (read-only for now)
- gencpp integration (orchestrating gencpp logic itself is a separate track)