Skip to content

Commit 7106ca3

Browse files
sakrutclaude
andcommitted
feat: add NuGet auto-release pipeline and publishing docs
Add release.yml workflow that triggers on version tags (v*), runs tests on all platforms, packs the global tool with the tag version, pushes to NuGet.org, and creates a GitHub Release. Add docs/PUBLISHING.md with publishing instructions and user setup guide. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 906843e commit 7106ca3

File tree

2 files changed

+212
-0
lines changed

2 files changed

+212
-0
lines changed

.github/workflows/release.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Release to NuGet
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
jobs:
8+
test:
9+
runs-on: ${{ matrix.os }}
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest, windows-latest, macos-latest]
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '8.0.x'
21+
22+
- name: Restore
23+
run: dotnet restore
24+
25+
- name: Build
26+
run: dotnet build --no-restore --configuration Release
27+
28+
- name: Test
29+
run: dotnet test --no-build --configuration Release --verbosity normal
30+
31+
publish:
32+
runs-on: ubuntu-latest
33+
needs: test
34+
permissions:
35+
contents: write
36+
37+
steps:
38+
- uses: actions/checkout@v4
39+
40+
- name: Setup .NET
41+
uses: actions/setup-dotnet@v4
42+
with:
43+
dotnet-version: '8.0.x'
44+
45+
- name: Extract version from tag
46+
id: version
47+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
48+
49+
- name: Pack global tool
50+
run: dotnet pack AiCodeGraph.Cli --configuration Release -p:Version=${{ steps.version.outputs.VERSION }}
51+
52+
- name: Verify tool installs
53+
run: |
54+
dotnet tool install --global --add-source AiCodeGraph.Cli/nupkg AiCodeGraph.Cli
55+
ai-code-graph --help
56+
57+
- name: Push to NuGet.org
58+
run: |
59+
dotnet nuget push AiCodeGraph.Cli/nupkg/AiCodeGraph.Cli.*.nupkg \
60+
--api-key ${{ secrets.NUGET_API_KEY }} \
61+
--source https://api.nuget.org/v3/index.json \
62+
--skip-duplicate
63+
64+
- name: Create GitHub Release
65+
uses: softprops/action-gh-release@v2
66+
with:
67+
generate_release_notes: true
68+
files: AiCodeGraph.Cli/nupkg/AiCodeGraph.Cli.*.nupkg

docs/PUBLISHING.md

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
# Publishing & Setup Guide
2+
3+
## Publishing to NuGet
4+
5+
AI Code Graph is packaged as a .NET global tool. Publishing makes it installable via:
6+
7+
```bash
8+
dotnet tool install --global AiCodeGraph.Cli
9+
```
10+
11+
### Automated Release (Recommended)
12+
13+
Push a version tag to main to trigger the release pipeline:
14+
15+
```bash
16+
# Update version in AiCodeGraph.Cli/AiCodeGraph.Cli.csproj if needed
17+
# Then tag and push:
18+
git tag v0.1.0
19+
git push origin v0.1.0
20+
```
21+
22+
The `.github/workflows/release.yml` pipeline will:
23+
1. Run tests on all platforms
24+
2. Pack the global tool
25+
3. Push to NuGet.org automatically
26+
27+
**Prerequisites:**
28+
- Add `NUGET_API_KEY` as a repository secret in GitHub Settings > Secrets > Actions
29+
- Get your API key from https://www.nuget.org/account/apikeys (scope: push packages for `AiCodeGraph.Cli`)
30+
31+
### Manual Release
32+
33+
```bash
34+
# Pack
35+
dotnet pack AiCodeGraph.Cli --configuration Release
36+
37+
# Push to NuGet.org
38+
dotnet nuget push AiCodeGraph.Cli/nupkg/AiCodeGraph.Cli.*.nupkg \
39+
--api-key YOUR_NUGET_API_KEY \
40+
--source https://api.nuget.org/v3/index.json
41+
```
42+
43+
NuGet indexing takes ~15 minutes after push.
44+
45+
### Version Bumping
46+
47+
Update the `<Version>` in `AiCodeGraph.Cli/AiCodeGraph.Cli.csproj`:
48+
49+
```xml
50+
<Version>0.2.0</Version>
51+
```
52+
53+
Follow semver: breaking changes = major, new features = minor, fixes = patch.
54+
55+
---
56+
57+
## User Setup Guide
58+
59+
### Install the Tool
60+
61+
```bash
62+
dotnet tool install --global AiCodeGraph.Cli
63+
```
64+
65+
### Quick Start (Any .NET Project)
66+
67+
```bash
68+
cd your-dotnet-project
69+
70+
# 1. Set up Claude Code integration (slash commands, MCP config, CLAUDE.md)
71+
ai-code-graph setup-claude
72+
73+
# 2. Analyze your solution
74+
ai-code-graph analyze YourSolution.sln
75+
```
76+
77+
That's it. Claude Code now has full architectural awareness of your codebase.
78+
79+
### What `setup-claude` Creates
80+
81+
| File | Purpose |
82+
|------|---------|
83+
| `.claude/commands/context.md` | `/context <method>` - method context before editing |
84+
| `.claude/commands/hotspots.md` | `/hotspots` - complexity hotspots |
85+
| `.claude/commands/duplicates.md` | `/duplicates` - code clone detection |
86+
| `.claude/commands/drift.md` | `/drift` - architectural drift |
87+
| `.mcp.json` | MCP server config for IDE integration |
88+
| `CLAUDE.md` (appended) | Auto-context instructions for the agent |
89+
90+
### Using with Claude Code
91+
92+
After setup, these slash commands are available in Claude Code sessions:
93+
94+
```
95+
/context ValidateUser # Shows complexity, callers, callees, cluster, duplicates
96+
/hotspots # Top methods by cognitive complexity
97+
/duplicates # Detected code clones
98+
/drift # Changes since baseline
99+
```
100+
101+
Claude Code will also automatically query method context before editing (via the CLAUDE.md instructions).
102+
103+
### Using with MCP-Compatible IDEs
104+
105+
The `.mcp.json` created by `setup-claude` works with:
106+
- **Claude Code** - auto-detected
107+
- **VS Code** (Copilot) - copy config to `.vscode/settings.json` under `mcp.servers`
108+
- **Cursor** - auto-detected from `.mcp.json`
109+
- **Windsurf** - auto-detected from `.mcp.json`
110+
111+
The MCP server exposes these tools:
112+
113+
| Tool | Parameters | Description |
114+
|------|-----------|-------------|
115+
| `get_context` | `method` (required) | Method summary with all relationships |
116+
| `get_hotspots` | `top`, `threshold` | Complexity hotspots |
117+
| `search_code` | `query`, `top` | Natural language code search |
118+
| `get_duplicates` | `method`, `threshold`, `top` | Code clone pairs |
119+
120+
### Using Standalone (CI / Scripts)
121+
122+
```bash
123+
# Save a baseline for drift detection
124+
ai-code-graph analyze MySolution.sln --save-baseline
125+
126+
# Check for complexity regressions in CI
127+
ai-code-graph drift --vs baseline.db --format json
128+
129+
# Generate hotspot report
130+
ai-code-graph hotspots --top 50 --format csv > hotspots.csv
131+
132+
# Find duplicates above threshold
133+
ai-code-graph duplicates --threshold 0.9 --format json
134+
```
135+
136+
### Rebuilding the Graph
137+
138+
After significant code changes, rebuild:
139+
140+
```bash
141+
ai-code-graph analyze YourSolution.sln
142+
```
143+
144+
The database at `./ai-code-graph/graph.db` is overwritten with fresh analysis.

0 commit comments

Comments
 (0)