Skip to content

Commit 910e66a

Browse files
committed
feat: Add production-ready features and documentation
- Added MIT LICENSE file - Created NuGet package configuration for global tool - Added GitHub Actions CI/CD workflow - Created CHANGELOG.md for version tracking - Enhanced README with detailed documentation - Configured project as .NET global tool (codecontext command)
1 parent bdea8f7 commit 910e66a

File tree

5 files changed

+156
-8
lines changed

5 files changed

+156
-8
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v3
18+
with:
19+
dotnet-version: '9.0.x'
20+
21+
- name: Restore dependencies
22+
run: dotnet restore
23+
24+
- name: Build
25+
run: dotnet build --configuration Release --no-restore
26+
27+
- name: Test
28+
run: dotnet test --no-restore --verbosity normal
29+
30+
- name: Pack
31+
run: dotnet pack src/CodeContext.CLI/CodeContext.CLI.csproj --configuration Release --output ./artifacts
32+
33+
- name: Upload artifacts
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: nuget-packages
37+
path: ./artifacts/*.nupkg

CHANGELOG.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
## [1.0.0] - 2024-10-11
6+
7+
### Added
8+
- Initial release of CodeContext.NET
9+
- Pattern detection engine using Roslyn API
10+
- Naming conventions detection
11+
- Error handling patterns (Result<T>, try-catch, exceptions)
12+
- Async/await patterns
13+
- Dependency injection patterns
14+
- Return type patterns
15+
- Context generation in multiple formats (JSON, Markdown, Plain Text)
16+
- AI prompt generation for ChatGPT and GitHub Copilot
17+
- Command-line interface with options for path, output, format, and verbose mode
18+
- Package dependency analysis from .csproj files
19+
- Architectural layer detection
20+
- VSCode snippet export functionality
21+
- Comprehensive unit tests
22+
23+
### Features
24+
- Analyzes C# codebases to detect coding patterns
25+
- Generates context files for AI tools
26+
- Supports multiple export formats
27+
- Ignores bin/obj folders automatically
28+
- Provides confidence scores for detected patterns

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Berkant
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,39 @@
11
# CodeContext.NET
22

3-
AI Context Generator for C# Codebases - Analyzes your C# projects to detect patterns and generate context for AI tools.
3+
AI Context Generator for C# Codebases - Analyzes your C# projects to detect patterns and generate context for AI tools like ChatGPT and GitHub Copilot.
44

55
## Features
66

7-
- Pattern detection (naming conventions, error handling, async patterns)
8-
- Package dependency analysis
9-
- Architecture layer detection
10-
- Multiple export formats (JSON, Markdown, Plain Text)
11-
- AI-ready prompts for ChatGPT and GitHub Copilot
7+
- **Pattern Detection**: Automatically detects coding patterns in your codebase
8+
- Naming conventions (PascalCase, camelCase, underscore prefixes)
9+
- Error handling patterns (Result<T>, try-catch, exceptions)
10+
- Async/await patterns
11+
- Dependency injection patterns
12+
- Return type patterns
13+
- **Package Analysis**: Identifies all NuGet packages used in your project
14+
- **Architecture Detection**: Recognizes common architectural layers
15+
- **Multiple Export Formats**: JSON, Markdown, Plain Text
16+
- **AI Integration**: Generates optimized prompts for ChatGPT and GitHub Copilot
17+
- **Smart Filtering**: Automatically excludes bin, obj, and hidden folders
1218

1319
## Installation
1420

21+
### As a Global Tool
1522
```bash
1623
dotnet tool install --global CodeContext.CLI
1724
```
1825

26+
### From Source
27+
```bash
28+
git clone https://github.com/Nonanti/CodeContext.NET
29+
cd CodeContext.NET
30+
dotnet build
31+
dotnet tool install --global --add-source ./src/CodeContext.CLI/nupkg CodeContext.CLI
32+
```
33+
1934
## Usage
2035

36+
### Basic Usage
2137
```bash
2238
# Analyze current directory
2339
codecontext
@@ -32,8 +48,16 @@ codecontext --format json --output ./output
3248
codecontext --verbose
3349
```
3450

51+
### Command Line Options
52+
- `-p, --path`: Path to analyze (default: current directory)
53+
- `-o, --output`: Output directory (default: current directory)
54+
- `-f, --format`: Output format - Json, Markdown, PlainText (default: Markdown)
55+
- `-v, --verbose`: Enable verbose output
56+
- `-h, --help`: Show help information
57+
3558
## Example Output
3659

60+
### Markdown Format
3761
```markdown
3862
## Detected Patterns
3963

@@ -50,15 +74,39 @@ codecontext --verbose
5074
- Confidence: 95%, Occurrences: 38
5175
```
5276

77+
### Using with AI Tools
78+
79+
Copy the generated context and paste it at the beginning of your ChatGPT conversation:
80+
```
81+
I'm working on a C# codebase with the following patterns:
82+
[Paste context here]
83+
84+
Now, help me write a new service that follows these patterns...
85+
```
86+
87+
## Requirements
88+
89+
- .NET 9.0 or later
90+
- Works on Windows, macOS, and Linux
91+
5392
## Building from Source
5493

5594
```bash
5695
git clone https://github.com/Nonanti/CodeContext.NET
5796
cd CodeContext.NET
97+
dotnet restore
5898
dotnet build
5999
dotnet test
60100
```
61101

102+
## Contributing
103+
104+
Contributions are welcome! Please feel free to submit a Pull Request.
105+
62106
## License
63107

64-
MIT
108+
MIT License - see [LICENSE](LICENSE) file for details
109+
110+
## Author
111+
112+
Created by Berkant ([@Nonanti](https://github.com/Nonanti))

src/CodeContext.CLI/CodeContext.CLI.csproj

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@
55
<TargetFramework>net9.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8+
9+
<!-- NuGet Package Properties -->
10+
<PackAsTool>true</PackAsTool>
11+
<ToolCommandName>codecontext</ToolCommandName>
12+
<PackageOutputPath>./nupkg</PackageOutputPath>
13+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
14+
15+
<PackageId>CodeContext.CLI</PackageId>
16+
<Version>1.0.0</Version>
17+
<Authors>Berkant</Authors>
18+
<Description>AI Context Generator for C# Codebases - Analyzes code patterns and generates context for AI tools</Description>
19+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
20+
<RepositoryUrl>https://github.com/Nonanti/CodeContext.NET</RepositoryUrl>
21+
<PackageTags>csharp;ai;code-analysis;roslyn;context-generation</PackageTags>
822
</PropertyGroup>
923

1024
<ItemGroup>
@@ -15,4 +29,4 @@
1529
<ProjectReference Include="..\CodeContext.Core\CodeContext.Core.csproj" />
1630
</ItemGroup>
1731

18-
</Project>
32+
</Project>

0 commit comments

Comments
 (0)