@ai-dev-tools/csharp-copilot-core
v0.0.33
Published
Core library for csharp-copilot
Readme
C# Unit Test Copilot Core
Core library for csharp-copilot - AI-powered C# unit test generation tool.
Installation
Global Installation (Recommended)
Install the package globally to use the csharputc command anywhere:
npm install -g @ai-dev-tools/csharp-copilot-coreOr if you're working with the source code:
npm install -g .Local Development
If you want to run from source without global installation:
# Build the project
npm run build
# Run directly
node out/command/index.js <command> [options]
# Or use npx
npx . <command> [options]Usage
The csharputc command provides several subcommands for different use cases:
Commands
1. Generate Unit Tests for Single File
csharputc utcmd -s <source-code-file-path>2. Batch Generate Unit Tests for Project/Solution
csharputc utbatch -s <project-or-solution-path>3. Generate Benchmark Report
csharputc utbenchmark -s <project-or-solution-path>4. VS Plugin Integration
csharputc utvspluginOptions
-s, --sourceCodePath: Source code file path, project path, or solution path-t, --testCodePath: Target test file or directory--af, --autofix: Auto-fix generated test code (0/1, default: 0)--keepFailedTest: Keep failed test cases (0/1, default: 1)--enableCov: Run code coverage (0/1, default: 0)--LLMModel: LLM model to use (default: "gpt4o")--source: Where the test copilot is running (local/vsplugin, default: "local")-m, --mode: Work mode (generate/repair, default: "generate")--np, --nugetPackagePath: NuGet packages path for code analyzer
Examples
Generate tests for a single C# file:
csharputc utcmd -s "C:\MyProject\MyClass.cs"Generate tests with auto-fix enabled:
csharputc utcmd -s "C:\MyProject\MyClass.cs" --af 1Batch generate tests for entire project:
csharputc utbatch -s "C:\MyProject\MyProject.csproj"Generate tests with code coverage:
csharputc utcmd -s "C:\MyProject\MyClass.cs" --enableCov 1Generate benchmark report for solution:
csharputc utbenchmark -s "C:\MySolution\MySolution.sln"Generate tests with custom test output path:
csharputc utcmd -s "C:\MyProject\MyClass.cs" -t "C:\MyProject\Tests\MyClassTests.cs"Help
To see all available options and commands:
csharputc --helpTo get help for a specific command:
csharputc utcmd --help
csharputc utbatch --help
csharputc utbenchmark --help
csharputc utvsplugin --helpDevelopment
Build
npm run buildThis will:
- Compile TypeScript files to JavaScript
- Copy liquid template files and tools to the output directory
Publish
publish to npmjs
npm logout
npm login --registry=https://registry.npmjs.org/
npm publish --registry https://registry.npmjs.org/ --access publicdel published package within 72 hours
npm unpublish @ai-dev-tools/[email protected]Note: if you want to publish to devops feeds, use the file in /devops
Scripts
build: Compile TypeScript and copy assetscopy-script: Copy liquid templates and tools to outputsetup-npm-auth: Setup authentication for Azure Artifacts
Dependencies
This project uses several key dependencies:
- yargs: Command-line argument parsing
- liquidjs: Template engine for code generation
- applicationinsights: Telemetry
- edge-js: .NET interop
- fast-xml-parser: XML parsing for test results
- node-fetch: HTTP requests for LLM APIs
License
This is an internal Microsoft tool for AI-powered C# unit test generation.
