# 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
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

- [ ] 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
