🧠🤖 AI-powered XML documentation generator for .NET projects. Leveraging OpenAI's API, this tool analyzes your code and generates meaningful, human-readable XML documentation with the help of advanced AI.
Caution
This project is in beta. It will reach General Availability (GA) with the first major release (v1.0).
dotnet-aidocument analyzes your .NET project using Microsoft.CodeAnalysis.CSharp to identify undocumented members and uses the OpenAI API to generate meaningful XML documentation for them. This tool simplifies and accelerates the process of maintaining high-quality, human-readable documentation.
This repository is available on NuGet under the name AiDocument.
- Install the tool globally or for a specific project/repository.
dotnet tool install -g AiDocument-
Move to the desired project folder.
-
Run the documentation generator.
dotnet-aidocument generateHere’s a flow diagram showing the sequence of execution of the prepare-commit-msg hook and its integration with dotnet-aicommitmessage to generate commit messages using the OpenAI API:
sequenceDiagram
participant User
participant Tool
participant OpenAI API
participant .NET Project
User->>Tool: Run command (generate)
Tool->>Project: Analyze undocumented members
Tool->>OpenAI API: Request documentation
OpenAI API-->>Tool: Return generated documentation
Tool-->>User: Output generated XML documentation
This tool provides several commands to simplify and customize the documentation process:
| Command | Description |
|---|---|
generate |
Analyzes the project and generates XML documentation for all undocumented members. |
set-settings |
Sets the OpenAI API key and configuration options. |
export-docs |
Exports the generated XML documentation to a specific folder or location. |
help |
Displays information about the available commands. |
version |
Displays the tool's version information. |
Here’s an example of how to use dotnet-aidocument:
-
Analyze the codebase for undocumented members:
dotnet-aidocument generate
-
Export the generated XML documentation:
dotnet-aidocument export-docs -o ./docs/xml
To debug and review the OpenAI responses during the documentation generation, use the -D flag. This will create a debug.json file with the API response data.
dotnet-aidocument generate -DBelow is an example of the generated XML documentation:
/// <summary>
/// Calculates the sum of two integers.
/// </summary>
/// <param name="a">The first integer.</param>
/// <param name="b">The second integer.</param>
/// <returns>The sum of the two integers.</returns>
public int Add(int a, int b) { return a + b; }Contributions are welcome! Feel free to submit issues, feature requests, or pull requests to help improve dotnet-aidocument.
This project is licensed under the MIT License.
