Kodify is an AI-powered .NET library that automates your project's documentation, code analysis, changelog generation, and visualization. It streamlines development workflows by enhancing standard project metadata with AI-curated explanations, intelligent code analysis using Roslyn, and interactive class diagrams via PlantUML.
-
Automated Documentation Generation
Generate comprehensive, user-focused README files using structured project data and AI-enhanced language. The documentation is built from source analysis and enhanced via the OpenAI API. -
Changelog Automation
Automatically generate curated changelogs by scanning Git commit history. Commit messages are processed to replace issue/PR references (like#123
) with clickable GitHub links for improved traceability. -
Static Code Analysis
Leverage Roslyn to analyze your C# code, detect API controllers, extract key project structure details, and automatically detect license files. -
Interactive Class Diagrams
Create comprehensive UML class diagrams (in PUML) grouped by namespace. Each class in the diagram links directly to its source file for quick navigation. -
Seamless Git Integration
Automatically detect your project's Git repository; normalize remote URLs and, when applicable, integrate with GitHub to enrich commit messages with clickable links. -
Customizable Content Generation
Use the included ContentBuilder and ReadmeGenerator to either automatically generate structured documentation or compose manual content enhanced by AI. -
OpenAI-Powered Enhancement
Improve documentation language, structure, and consistency through customizable prompt templates and an integrated OpenAI service.
Install Kodify via the .NET CLI:
dotnet add package Kodify
Use the OpenAIService
to create an instance of the AI service which serves as your docs enhancer:
var aiConfig = new OpenAIConfig
{
ApiKey = "",
Model = "gpt-4o-mini"
};
var aiService = new OpenAIService(openAiConfig);
Generate a README by combining analytical data with AI enhancement:
var markdownGenerator = new MarkdownGenerator(aiService);
// Generate a README file for your project
await markdownGenerator.GenerateReadMe("MyProject",
"A concise summary that showcases the project's purpose, features, and value.",
"Step-by-step usage instructions go here..." // Shortened, of course
);
Automatically generate a changelog that aggregates commit history:
// This invokes the ChangelogGenerator which creates a CHANGELOG.md in your project root
markdownGenerator.GenerateChangelog();
markdownGenerator.GenerateChangelog(aiService); // This uses the AI service to clean up messy commits, PRs and comments.
Visualize your project's structure by generating class diagrams:
var outputDiagramPath = Path.Combine(projectInfo.ProjectPath, "Diagrams");
var diagramGenerator = new ClassDiagramGenerator();
diagramGenerator.GenerateInteractiveClassDiagram(projectInfo.ProjectPath, outputDiagramPath);
-
Structured Content Building:
TheContentBuilder
compiles key details (e.g., API detection, licenses, and key features) into markdown, which is later enhanced by the AI. -
Manual Content Customization:
Not a fan of full automation? UseBuildManualContent
from the ContentBuilder to create a more traditional README layout, then enhance with the AI service. -
AI Enhancement:
TheReadmeGenerator
andMarkdownGenerator
blend the raw content with prompt templates (defined inPromptTemplates.cs
), resulting in user-friendly, production-ready documentation.
- Commit Curation:
TheChangelogGenerator
groups changes by Git tags (or treats commit history as unreleased changes) and annotates commit messages. Issue references like#123
are automatically converted to clickable links when a GitHub repository is detected.
-
CodeAnalyzer:
Parses C# source files to generate aProjectInfo
object. It provides insights such as detected API controllers, directory structures, and license files. -
ClassDiagramGenerator:
Scans all C# files and builds an interactive PUML class diagram that you can view with any PlantUML-compatible tool.
- GitRepositoryService & GitHubApiService:
These services detect Git repositories, normalize URLs (removing any trailing.git
), and optionally integrate with GitHub for enriching repository context and commit annotations.
-
OpenAI API:
Set up yourOpenAIConfig
by ensuring theOPENAI_API_KEY
environment variable is properly configured. -
Prompt & Template Customization:
EditPromptTemplates.cs
to tailor the AI prompts to your desired tone and structure. -
Advanced Settings:
Extend classes likeContentBuilder
andReadmeGenerator
to further customize the generated documentation and changelog to suit your project's style.
-
Source Code & Repository:
GitHub Repository -
License:
Kodify is released under the MIT License. See LICENSE for more information.
- LibGit2Sharp for Git operations.
- Microsoft.CodeAnalysis (Roslyn) for robust code analysis.
- OpenAI API for state-of-the-art language enhancements.
- PlantUML for generating interactive class diagrams.