|
| 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