Skip to content

A collection of command-line tools for analyzing and manipulating C# codebases using Roslyn

License

Notifications You must be signed in to change notification settings

CyberdyneDevelopment/claude-tools

Repository files navigation

CyberdyneDevelopment.RoslynTools

Full semantic understanding of C# solutions for Claude Code through Roslyn's compilation model.

A server-based architecture that provides comprehensive code analysis, generation, and transformation capabilities using Roslyn's semantic model. All tools operate on an in-memory workspace with full type resolution and cross-project awareness.

Architecture

Global Server Coordination

RoslynTools uses a Global Coordinator architecture:

  • Global Server (localhost:5000) manages multiple solution servers
  • Solution Servers (ports 5001+) each maintain one solution's Roslyn Workspace
  • Automatic port assignment - no manual configuration needed
  • Real-time monitoring via SignalR for live activity tracking
  • Skill executables auto-discover their solution's server port

Server/Client Model

Each solution server maintains an in-memory Roslyn Workspace with:

  • Full Compilation with all projects loaded
  • SemanticModel for symbol resolution and type information
  • Cross-project type hierarchy and reference tracking
  • Real-time diagnostics with full context
  • Transaction-safe commits with rollback support

Capabilities

Analysis (Read-only semantic analysis):

  • ComplexityAnalyzer - Cyclomatic complexity with method symbols
  • TypeFinder - Find types with full inheritance information
  • NamespaceExplorer - Explore namespace hierarchy across solution
  • TypeCollisionDetector - Detect duplicate type names
  • MemberIdentifier - Identify members with semantic information
  • BuildFixer - Analyze compilation diagnostics

Generation (Create new code):

  • DocGenerator - Generate XML docs using semantic inference
  • CodeWriter - Generate and validate new code

Transformation (Modify existing code):

  • CodeReader - Strip documentation from code
  • CodeEditor - Apply semantic-aware refactorings

Quick Start

Installation

Install the global CLI tool:

dotnet tool install -g CyberdyneDevelopment.ClaudeTools

Setup in Your C# Repository

Navigate to any C# repository and run:

cd my-csharp-project
claude-tools init

This will:

  • Auto-detect your solution file
  • Let you select skills to enable (complexity-analyzer, type-finder, refactor, etc.)
  • Create .claude-tools.json configuration (port assigned automatically)
  • Copy selected skills with executables to .claude/skills/
  • Update .gitignore

Start the Server

claude-tools server start

The server will:

  • Auto-start the Global Coordinator (if not running)
  • Register with Global Server and get assigned port
  • Start in the background
  • Load your solution into memory
  • Expose analysis endpoints on assigned port
  • Track process ID in .claude-tools/server.pid

Check Status

claude-tools server status

Manage Skills

# List all available skills
claude-tools skills list

# Enable a skill
claude-tools skills enable namespace-explorer

# Disable a skill
claude-tools skills disable namespace-explorer

Stop the Server

claude-tools server stop

Use the Client API (Advanced)

For programmatic access:

using CyberdyneDevelopment.RoslynTools.Client;

var client = new RoslynWorkspaceClient("http://localhost:5000");

// Analyze complexity with semantic model
var complexity = await client.AnalyzeComplexity(
    projectFilter: "MyProject.Core",
    groupBy: GroupBy.Class
);

// Find types with full symbol information
var types = await client.FindTypes(
    pattern: ".*Service$",
    useRegex: true
);

// Generate documentation
await client.GenerateDocumentation(
    scope: DocScope.AllPublic,
    inferFromNames: true
);

// Commit all changes
await client.Commit();

Documentation

See the docs directory for complete documentation:

Requirements

  • .NET 10.0 SDK
  • Roslyn 5.0.0-2.final
  • Windows, macOS, or Linux

Version

This project uses Nerdbank.GitVersioning for semantic versioning.

Current version: 0.1.0-alpha

License

See LICENSE file for details.

Claude Code Integration

This project includes skills for Claude Code in the Skills/ directory.

After running claude-tools init, the selected skills will be available in .claude/skills/ for use with Claude Code. These skills provide intelligent workflows for:

  • complexity-analyzer - Analyze cyclomatic complexity across your codebase
  • type-finder - Find types with full inheritance and interface information
  • namespace-explorer - Explore namespace hierarchy and organization
  • type-collision-detector - Detect duplicate type names across projects
  • member-identifier - Identify class members with semantic information
  • build-fixer - Analyze and fix compilation diagnostics
  • doc-generator - Generate XML documentation with semantic inference
  • code-reader - Read code with semantic awareness
  • code-writer - Generate new code with validation
  • code-editor - Apply semantic-aware refactorings
  • refactor - Common refactoring operations

CLI Commands Reference

claude-tools init

Initialize RoslynTools in the current directory with interactive prompts.

claude-tools server start

Start the solution server (auto-starts Global Server if needed).

claude-tools server stop

Stop the running solution server.

claude-tools server status

Check if the solution server is running and view status information.

claude-tools global start

Manually start the Global Coordinator (usually auto-started).

claude-tools global stop

Stop the Global Coordinator (stops all solution servers).

claude-tools global status

View all active solution servers and their ports.

claude-tools monitor

Launch real-time activity monitor for all solutions.

claude-tools skills list

List all available skills and their enabled status.

claude-tools skills enable <skill-name>

Enable a skill by copying it to .claude/skills/.

claude-tools skills disable <skill-name> [--delete-files]

Disable a skill, optionally deleting the files.

About

A collection of command-line tools for analyzing and manipulating C# codebases using Roslyn

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •