Commit 5886ce5
Major release introducing a unified graph query system, architectural analysis capabilities, and significant CLI improvements for better LLM integration. (#1)
* Improve OpenAI embedding error handling and model selection
* Add next-milestone PRD, Task Master plan, and token-efficient docs
* Expand next-milestone tasks (64-73) with subtasks
* Add v1→v2 changelog section to next-milestone PRD (task 64)
Documents the key shifts: compact-first outputs, pipeline slimming,
and DB staleness awareness. Explains why token economy is the priority.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add --format compact|table|json|csv with compact as default (task 65)
- Add OutputFormat enum and OutputOptions shared helper
- Add docs/output-contract.md specifying compact format rules
- Update agent-facing commands to default to compact format:
- hotspots, dead-code, coupling, callgraph, impact, context
- Compact format: one line per item, bounded lists, stable IDs
- JSON schema uses consistent field names (methodId, items, metadata)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add --id option for stable method selection (task 66)
- Add MethodResolver helper for consistent method resolution
- Add --id option to context, callgraph, impact, similar commands
- Resolution precedence: --id > exact match > substring match
- Context command now prints method ID for agent copy-paste
- Update output-contract.md and LLM-QUICKSTART.md with --id examples
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add status command with staleness detection (task 67)
- Save analysis metadata: analyzed_at, solution_path, tool_version, git_commit
- Add 'status' command to show db info and staleness check
- Staleness heuristics: git commit change, source file modification times
- Add GitHelpers.GetCurrentCommitHash() and GetLastModifiedTime()
- Compact, table, and JSON output formats supported
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add --stages core|full option for pipeline slimming (task 68)
- Add --stages option to analyze command (default: core)
- core: all stages except clustering (fast, essential features)
- full: all stages including intent clustering
- Save stages metadata for status command
- ClustersCommand shows helpful message when run after core analysis
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Streamline docs: compact LLM quickstart + trim README (task 69)
- Update LLM-QUICKSTART.md with new features (status, --stages, --id)
- Trim README from 329 to 109 lines (67% reduction)
- Add links to detailed docs (output-contract, LLM quickstart)
- Focus README on essentials: install, quick start, command table
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* MCP: compact responses, bounded defaults, MethodId in output (task 70)
- ContextHandler: Include MethodId in output for agent copy-paste
- QueryHandler hotspots: Compact one-line-per-item format
- QueryHandler dead-code: Add top parameter, compact format
- All handlers now default to bounded outputs
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add CLI output snapshot tests for regression prevention
- Add SnapshotTests.cs with golden file comparisons for:
- hotspots (compact/json)
- dead-code (compact/json)
- callgraph (compact/json)
- impact (compact/json)
- coupling (compact/json)
- context (compact/json)
- tree (compact)
- Add snapshot update workflow: UPDATE_SNAPSHOTS=1 dotnet test
- Add docs/snapshot-testing.md documenting the workflow
- Fix CliCommandTests JSON key expectation (hotspots -> items)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add GraphTraversalEngine with configurable strategies
Implements Task 74: Graph Traversal Engine with Configurable Strategies
Core components:
- TraversalTypes.cs: Direction, Strategy, Ranking enums
- TraversalConfig.cs: Configuration record with validation
- TraversalResult.cs: Node, Edge, and Result records
- FilterConfig.cs: Namespace/type/accessibility filtering
- GraphTraversalEngine.cs: BFS/DFS traversal with ranking
Features:
- BFS and DFS traversal strategies
- Direction control: Callers, Callees, Both
- Configurable depth limits and max results
- Four ranking strategies:
- BlastRadius: Transitive caller count
- Complexity: Cognitive complexity from metrics
- Coupling: Afferent + Efferent coupling
- Combined: Weighted normalized combination
- Session-level caching for performance
- Filter support for namespaces, types, accessibility
Tests: 37 new tests covering types, traversal, and ranking
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add LayerDetector with architectural pattern matching
Implements Task 76.1: Core layer detection infrastructure
- ArchitecturalLayer enum: Presentation, Application, Domain,
Infrastructure, Shared, Unknown
- LayerAssignment record for storing detection results
- LayerDetector with pattern-based detection:
- Default patterns for Clean Architecture/DDD
- Type name hints (Controller, Repository, Handler suffixes)
- Confidence scoring (1.0 for exact match, 0.5 for partial)
- Dependency validation rules for Clean Architecture
- 12 unit tests covering detection and validation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add TypeLayers storage support for architectural layer detection
Implements Task 76.2: Storage methods for layer assignments
Schema changes:
- Add TypeLayers table (TypeId, Layer, Confidence, Reason)
- Add IX_TypeLayers_Layer index
IStorageService interface additions:
- SaveLayerAssignmentsAsync
- GetLayerAssignmentsAsync
- GetLayerForTypeAsync
StorageService implementation with proper transaction handling.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add dependency-direction refinement to LayerDetector
Implements RefineByDependencyDirectionAsync() that analyzes call graph
dependencies between types and adjusts layer assignment confidence based
on Clean Architecture dependency rules:
- Lowers confidence when types violate allowed dependency directions
(e.g., Domain depending on Infrastructure)
- Boosts confidence for low-confidence types with consistent valid deps
- Clamps confidence to minimum 0.1 to prevent negative values
- Adds violation warnings to Reason field
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add layers CLI command for architectural layer assignments
Implements LayersCommand following ICommandHandler pattern:
- Displays type-to-layer assignments with confidence scores
- Supports filtering by layer (--layer) and minimum confidence
- Outputs in compact, table, JSON, or CSV formats
- Shows violations with [!] marker in compact mode
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add BlastRadiusAnalyzer for transitive impact computation
Implements blast radius computation using BFS on reverse call graph:
- Counts direct and transitive callers for each method
- Computes depth (max distance from entry points)
- Identifies entry points (methods with no callers) that can trigger code
- Performance: handles 1000+ methods in <2 seconds
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add BlastRadius and BlastDepth columns to Metrics table
- Extends schema with BlastRadius and BlastDepth columns
- Adds index on BlastRadius for efficient sorting
- Implements SaveBlastRadiusAsync using UPSERT pattern
- Updates GetMethodMetricsAsync to return blast radius data
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Integrate blast radius computation into analysis pipeline
- Adds ComputeBlastRadiusStage to AnalysisStageHelpers
- Runs after StoreResultsStage when call graph is available
- Shows verbose output with max blast radius and high-impact count
- Persists results to Metrics table via SaveBlastRadiusAsync
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add blast radius display to hotspots and context commands
Hotspots command:
- Adds --sort option (complexity|blast-radius|risk)
- Shows blast radius in output when sorting by blast or risk
- Includes risk score: complexity * log(blast_radius + 1)
Context command:
- Shows blast radius with depth and computed risk score
Updates GetHotspotsWithThresholdAsync to include BlastRadius/BlastDepth
and support custom sort ordering.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add GraphQuery record hierarchy for unified query schema
Defines complete query model with:
- QuerySeed: starting points (MethodId, Pattern, Namespace, Cluster)
- QueryExpand: traversal control (Direction, MaxDepth, Transitive)
- QueryFilter: inclusion/exclusion rules (namespaces, types, complexity)
- QueryRank: result ordering (BlastRadius, Complexity, Coupling, Combined)
- QueryOutput: format and limits (Compact/Json/Table, MaxResults)
Supporting enums: ExpandDirection, RankStrategy, QueryOutputFormat
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add GraphQueryValidator for query validation
Implements validation rules:
- Seed must have at least one non-null property
- MaxDepth bounds (0-100)
- MinComplexity <= MaxComplexity
- No overlapping Include/Exclude namespaces
- MaxResults bounds (1-1000)
- Empty/whitespace checks for all string properties
Includes ValidationResult record and extension method for fluent usage.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add GraphQueryExecutor with TraversalEngine bridge
Implements GraphQueryExecutor that:
- Validates GraphQuery via GraphQueryValidator before execution
- Resolves seeds (MethodId, MethodPattern, Namespace, Cluster)
- Translates GraphQuery to TraversalConfig for GraphTraversalEngine
- Handles ExpandDirection.None to return seed-only results
- Applies ranking strategies (Complexity, BlastRadius, Coupling, Combined)
- Formats results with optional metrics and location info
- Supports MaxResults limiting and execution time tracking
Includes 19 comprehensive tests covering all query scenarios.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add query plan caching for GraphQueryExecutor
Implements QueryPlanCache with:
- Thread-safe ConcurrentDictionary storage
- LRU eviction when cache exceeds max size (default 100)
- Time-based expiration (default 5 minutes)
- SHA256-based query hashing (excludes Output settings)
- Hit/miss tracking with GetStats() method
GraphQueryExecutor integration:
- Optional useCache parameter (default true)
- ClearCache() and GetCacheStats() methods
- Caches resolved seeds and expand direction
Includes 13 QueryPlanCache tests and 4 caching integration tests.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add JSON serialization and query command for GraphQuery
GraphQuerySerializer provides:
- JSON serialization with camelCase naming and enum strings
- Deserialization with TryDeserialize error handling
- JSON Schema generation (draft-07) with full property docs
QueryCommand CLI command:
- Execute queries from --query-file or inline JSON argument
- --schema flag outputs JSON schema
- Supports all output formats (compact, json, table)
- Validates queries before execution
Includes 13 serializer tests covering round-trip, enums, and schema.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add forbidden dependency detection with check-deps command
DependencyRuleEngine provides:
- Glob pattern matching for source/target namespaces
- Built-in Clean Architecture rules (12 default rules)
- Custom rules via JSON file with includeDefaults option
- Violation detection with file:line locations
- Severity levels (Error, Warning, Info)
check-deps CLI command:
- --rules <file> for custom rules
- --show-rules to display loaded rules
- --sample to generate example rules.json
- Groups violations by rule in output
- JSON output format supported
Includes 18 tests covering pattern matching, rule loading, and detection.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add quick query options to QueryCommand for easier CLI usage
- Added --seed option for quick method pattern or ID matching
- Added --depth, --direction, --rank, --top options for common parameters
- Kept --json and --query-file for full JSON query support
- Auto-detects pattern vs exact ID based on wildcards (* or ?)
- Updated command description for agent usage
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add cg_query MCP tool for unified graph queries
- Exposes GraphQueryExecutor via MCP as cg_query tool
- Supports seed pattern, direction, depth, rank, and top parameters
- Auto-detects wildcards to use pattern vs exact ID lookup
- Excludes test methods by default
- Token-optimized compact response format
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add ProtectedZoneManager for 'do not touch' zone marking
- ProtectedZone model with DoNotModify, RequireApproval, Deprecated levels
- JSON config loading from .ai-code-graph/protected-zones.json
- Glob pattern matching for method/namespace/type identification
- Methods for checking protection and filtering protected methods
- 20 unit tests covering all functionality
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Integrate protected zone warnings into context, impact, callgraph, and MCP
- Context command: shows warning if method is in protected zone
- Impact command: lists protected methods in blast radius
- Callgraph command: marks protected methods in call graph
- MCP cg_query: includes protection warnings in results
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Add architectural summary to context command
- Added layer assignment with confidence score
- Enhanced blast radius with entry points detection
- Added architectural notes section with warnings for:
- High blast radius (>50 callers)
- High complexity (CC>15)
- Protection zone status
- Deprecated callee calls
- Layer violation detection
- Updated snapshot tests
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Deprecate token/semantic search in favor of graph query
- Updated CLI help text for search commands to point to query
- Updated MCP tool descriptions to indicate search is fallback
- Updated slash commands with deprecation notes
- Updated CLAUDE.md with recommended workflow (query first)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Update TaskMaster tasks status to done
All tasks completed in this session:
- Task 80: Graph-First Query CLI Command
- Task 81: MCP Graph Query Tool
- Task 79: Protected Zone Marking
- Task 83: Architectural Summary in Context
- Task 82: Deprecate Token Search
- Task 71: Benchmark artifacts gitignore (was already done)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* remove unessery doc
* 0.3.0
* Sync all slash commands with CLI commands
- Add missing slash commands: query, status, layers, check-deps
- Update CLAUDE.md with all 21 user-facing commands
- Update SetupClaudeCommand.cs to generate all command files
- Add content generators for: impact, dead-code, coupling, diff,
semantic-search, query, status, layers, check-deps
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix windows issue with unicodes.
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Krystian Mikrut <krmk@softwaremind.com>1 parent 4f9bbea commit 5886ce5
163 files changed
Lines changed: 21518 additions & 1231 deletions
File tree
- .claude/commands/cg
- .taskmaster
- docs
- reports
- tasks
- AiCodeGraph.Cli
- Commands
- Helpers
- Mcp/Handlers
- AiCodeGraph.Core
- Analysis
- Architecture
- Embeddings
- Query
- Storage
- AiCodeGraph.Tests
- Snapshots
- docs
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
3 | 6 | | |
4 | 7 | | |
5 | 8 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
0 commit comments