CSharpFix

iriyaverma@iriyaverma

OpenClaw plugin for diagnosing and fixing common C# compiler errors

Readme

CSharpFix

An OpenClaw plugin for diagnosing and fixing common C# compiler errors.

Created by Riya Verma.

CSharpFix ships a curated database of 25+ common C# compiler errors (CSxxxx codes), each with explanations, suggested fixes, before/after examples, and links to official Microsoft documentation. It integrates with OpenClaw as agent tools, a CLI subcommand, and an automatic error detection hook.

Installation

bash
# From the OpenClaw plugin registry
openclaw plugin install csharpfix

# Or manually
cd CSharpFix
npm install
npm run build

Error Categories

CategoryDescriptionExamples
typeType mismatch and conversion errorsCS0029, CS0165, CS0428, CS0535
nullNullable reference type warningsCS8600, CS8602, CS8604
asyncAsync/await usage errorsCS4033
linqLINQ-related errors—
syntaxSyntax and structure errorsCS0161, CS0501, CS0542, CS1001
accessMember access and visibility errorsCS0117, CS0120, CS1061, CS1929
genericGeneric type argument errorsCS0411
castExplicit cast and conversion errorsCS0266
namespaceUsing directives and namespace resolutionCS0103, CS0234, CS0246
miscMiscellaneous errorsCS0619

Agent Tools

CSharpFix registers three tools for use by OpenClaw agents:

csharp_fix

Paste raw compiler output and get diagnostics for every error detected.

csharp_explain

Look up a specific error code (e.g. CS0029) to get a detailed explanation, suggested fixes, and code examples.

csharp_errors

List all known errors, optionally filtered by category.

Auto-Detection

CSharpFix registers an after_tool_call hook that watches for C# compiler error patterns (error CS\d{4}) in tool output. When detected, it automatically appends diagnostics and fix suggestions — no manual invocation needed.

CLI

bash
# List all known errors
openclaw csharpfix errors

# List errors in a specific category
openclaw csharpfix errors null

# Look up a specific error
openclaw csharpfix lookup CS0029

# List all categories
openclaw csharpfix categories

Testing

bash
npm test

Tests cover:

  • Error database integrity (25+ entries, all required fields, no duplicates)
  • Compiler output parsing (MSBuild, dotnet build, simple formats)
  • Markdown formatting (single result, error list, multiple results)

Project Structure

text
CSharpFix/
├── index.ts                   # Plugin entry point
├── openclaw.plugin.json       # Plugin manifest
├── package.json
├── tsconfig.json
└── src/
    ├── types.ts               # TypeScript interfaces
    ├── errors.ts              # Error database (25+ entries)
    ├── parser.ts              # Compiler output parser
    ├── formatter.ts           # Markdown formatter
    ├── cli.ts                 # CLI subcommand handler
    └── __tests__/
        ├── errors.test.ts
        ├── parser.test.ts
        └── formatter.test.ts

License

MIT