new csharp support track
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Track csharp_language_support_tools_20260310 Context
|
||||
|
||||
- [Specification](./spec.md)
|
||||
- [Implementation Plan](./plan.md)
|
||||
- [Metadata](./metadata.json)
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"track_id": "csharp_language_support_tools_20260310",
|
||||
"type": "feature",
|
||||
"status": "new",
|
||||
"created_at": "2026-03-10T01:15:00Z",
|
||||
"updated_at": "2026-03-10T01:15:00Z",
|
||||
"description": "C# language support tools (Unreal build script, Unity and Godot scripting usage)."
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
# Implementation Plan: C# MCP Tools
|
||||
|
||||
## Phase 1: Grammar Integration & Base Parser
|
||||
- [ ] Task: Update project dependencies (e.g., `requirements.txt` or `pyproject.toml`) to include the native `tree-sitter-c-sharp` dependency.
|
||||
- [ ] Task: Write Tests: Verify the tree-sitter parser can successfully initialize the C# language and parse a simple `namespace { class A { void M() {} } }` string.
|
||||
- [ ] Task: Implement: Create `src/csharp_parser.py` (or extend existing AST parsers) to handle the base C# tree-sitter initialization and generic node walking.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 1: Grammar Integration & Base Parser' (Protocol in workflow.md)
|
||||
|
||||
## Phase 2: Structural & Context Tools
|
||||
- [ ] Task: Write Tests: Verify `cs_get_skeleton` and `cs_get_code_outline` against a complex C# file containing namespaces, classes, properties, attributes, and XML docstrings.
|
||||
- [ ] Task: Implement: Add `cs_get_skeleton` logic to extract namespaces, classes, method signatures, attributes, and replace bodies with `...`.
|
||||
- [ ] Task: Implement: Add `cs_get_code_outline` and `cs_get_docstring` logic to traverse the AST and map line numbers and comments.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 2: Structural & Context Tools' (Protocol in workflow.md)
|
||||
|
||||
## Phase 3: Surgical Editing Tools
|
||||
- [ ] Task: Write Tests: Verify `cs_get_definition` returns the exact source text of a targeted method or class, and `cs_update_definition` replaces it accurately within a larger file.
|
||||
- [ ] Task: Implement: Add `cs_get_definition` logic using AST line/byte ranges.
|
||||
- [ ] Task: Implement: Add `cs_update_definition` and `cs_set_signature` logic to perform string replacement based on strict AST node boundaries.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 3: Surgical Editing Tools' (Protocol in workflow.md)
|
||||
|
||||
## Phase 4: MCP Client Integration & Polish
|
||||
- [ ] Task: Write Tests: Verify the new tools are successfully registered and invokable via the `mcp_client.py` unified interface.
|
||||
- [ ] Task: Implement: Register the new `cs_*` functions as official tools in `src/mcp_client.py`.
|
||||
- [ ] Task: Implement: Ensure the caching layer (mtime invalidation) is correctly applied to the new C# parsing operations.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 4: MCP Client Integration & Polish' (Protocol in workflow.md)
|
||||
@@ -0,0 +1,32 @@
|
||||
# Specification: C# MCP Tools
|
||||
|
||||
## Overview
|
||||
Expand the Conductor's AI context-gathering and surgical editing capabilities by introducing full Tree-Sitter parsing support for C#. This brings C# to feature-parity with existing Python MCP tools, enabling deep AST-driven structural mapping, documentation extraction, and precise code modification, specifically targeting Unreal Engine build scripts, and Unity/Godot scripting.
|
||||
|
||||
## Functional Requirements
|
||||
- **Grammar Integration:**
|
||||
- Introduce the stable `tree-sitter-c-sharp` grammar to the project's parsing environment as a native dependency to generate deterministic Abstract Syntax Trees for `.cs` files.
|
||||
- **Structural Parsing Tools:**
|
||||
- **`cs_get_skeleton`:** Extract a high-level view of a C# file, containing all namespaces, class/struct/interface declarations, fields, properties, and method signatures with their associated XML docstrings. Method bodies will be replaced with `...`.
|
||||
- **`cs_get_code_outline`:** Generate a hierarchical text outline showing line ranges for major structural elements (namespaces, classes, methods).
|
||||
- **Documentation & Context Tools:**
|
||||
- **`cs_get_docstring`:** Extract the XML docstring (`///`) immediately preceding a class, field, property, or method definition.
|
||||
- **`cs_find_usages`:** Locate usages of specific C# symbols across a file or directory using strict regex or AST node analysis.
|
||||
- **Surgical Editing Tools:**
|
||||
- **`cs_get_definition`:** Extract the full source code of a specific C# method, class, or property.
|
||||
- **`cs_update_definition`:** Surgically replace the implementation of a specific C# method or class without relying on generic search-and-replace strings.
|
||||
- **`cs_set_signature`:** Update only the signature (modifiers, return type, parameters) of a C# method.
|
||||
|
||||
## Non-Functional Requirements
|
||||
- **Performance:** Parsing and skeleton generation should utilize the existing `mtime` invalidation cache to ensure near-instantaneous responses.
|
||||
- **Robustness:** The parser must gracefully handle malformed or incomplete C# code (e.g., during active development), returning as much structural information as possible rather than failing entirely.
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] A new suite of C#-specific tools (`cs_get_skeleton`, `cs_get_code_outline`, `cs_get_definition`, `cs_update_definition`) is registered and available via the MCP Client.
|
||||
- [ ] Automated tests verify that `cs_get_skeleton` correctly identifies namespaces, classes, methods, and C#-specific constructs (like attributes `[Serializable]` and properties `{ get; set; }`).
|
||||
- [ ] `cs_update_definition` successfully replaces a multi-line method body while maintaining the surrounding file structure and indentation.
|
||||
- [ ] The `tree-sitter-c-sharp` native dependency is successfully integrated into the python environment setup (`uv` / `requirements.txt`).
|
||||
|
||||
## Out of Scope
|
||||
- Full language server protocol (LSP) features like deep cross-file type inference, semantic variable renaming, or Roslyn integration.
|
||||
- Automated code formatting or linting for C# (this relies on external ecosystem tools like `dotnet format`).
|
||||
Reference in New Issue
Block a user