feat: Android navigation and Kotlin analysis support#18
feat: Android navigation and Kotlin analysis support#18linhdmn merged 1 commit intoFreePeak:mainfrom
Conversation
|
Hi @hossihub please make the pipeline success running. |
linhdmn
left a comment
There was a problem hiding this comment.
Code review with inline comments
| "--watch" | ||
| ], | ||
| "command": "/Users/linh.doan/work/harvey/freepeak/leankg/.worktrees/feature-leankg-proc/target/debug/deps/test_all_tools_return_data-a17b878fb83cf791" | ||
| "command": "/var/home/christian/Documents/Dev/LeanKG/target/debug/deps/mcp_tools_full_tests-a9f9067ddb2e673b" |
There was a problem hiding this comment.
nitpick: Hardcoded local development path - this should be excluded or made relative
linhdmn
left a comment
There was a problem hiding this comment.
Code review with additional comments
| // Link DAOs to database (heuristic: DAOs referenced in same file as database) | ||
| for dao in daos { | ||
| // Simple heuristic: if DAO is in same file as Database, assume relationship | ||
| relationships.push(Relationship { |
There was a problem hiding this comment.
question: This heuristic links DAOs to databases based on same-file presence. What's the confidence score rationale (0.7)? Should this be documented as a limitation?
| fn extract_providers( | ||
| &self, | ||
| content: &str, | ||
| modules: &[CodeElement], |
There was a problem hiding this comment.
nit: Consider handling Unicode properly - char_indices() may not correctly handle multi-byte characters when incrementing by 1
- Untrack .mcp.json (hardcoded local paths) and add to .gitignore - Document find_class_body_end byte-index semantics for UTF-8 correctness - Add confidence rationale and limitation comments for DAO heuristic - Enrich DAO relationship metadata with heuristic name and caveat note
| "string" => "uses_string_resource", | ||
| "drawable" => "uses_drawable_resource", | ||
| "layout" => "uses_layout_resource", | ||
| "id" => "references_view_by_id", |
There was a problem hiding this comment.
concern: Both extract_r_references (line ~29) and extract_resource_methods (line ~67) will match getString(R.string.xxx), creating duplicate relationships. Consider deduplicating or having one pattern exclude what the other catches.
| @@ -42,33 +44,114 @@ impl Clone for MCPServer { | |||
| graph_engine_cache: self.graph_engine_cache.clone(), | |||
There was a problem hiding this comment.
nit: IntentParser::new() is called on every MCPServer clone. If MCPServer is cloned frequently, consider using Arc<IntentParser> to share the parser instance.
| // Create a CodeElement for the XML document structure | ||
| elements.push(CodeElement { | ||
| qualified_name: format!("{}::{}", self.file_path, root_element), | ||
| element_type: "XMLDocument".to_string(), |
There was a problem hiding this comment.
note: Generic XML extraction only captures the root element name. No child elements, attributes, or structure are extracted. Consider documenting this as a limitation in user-facing docs.
57c5346 to
d8c1268
Compare
- Complete Jetpack Compose Navigation XML parser (res/navigation/*.xml) - Kotlin DSL navigation support: composable(route), navigation(), argument() - Fragment-based navigation extractor with regex pattern matching - Android TV / Leanback navigation support - Navigation relationship types: nav_action, requires_arg, deep_link, navigates_to - Deep annotation extractor with metadata (annotation_entry, annotation_name, arguments) - Room database extractor (@entity, @dao, @database detection) - Hilt dependency injection component graph extraction - Android resource reference linking (R.id, R.layout, R.string) - ViewBinding and synthetic imports detection - Gradle build system parsing (multi-module dependencies) - Function modifiers: suspend, inline, operator, infix, extension, receiver_type - Class kinds: data, sealed, abstract, open, object, companion - Type parameters and generics - Scope function tagging in call graphs (let, run, apply, with, etc.) - Extension function detection and resolution - Multi-language call graph builder with confidence scoring - Kotlin scope function awareness (confidence 0.3) - Extension function call resolution - Cross-file call resolution with unresolved symbol tracking - Support for Go, TypeScript, Python, Rust, Java, Kotlin, Bash, Ruby, PHP, Elixir, R, Perl - get_nav_graph: Query navigation destinations, actions, arguments - find_route: Resolve route strings and action IDs - get_screen_args: List destination arguments with types - get_nav_callers: Find all navigation call sites - search_annotations: Find code by annotation type - Existing tools now work uniformly across all languages - Parallel and sync indexer paths for performance - XML layout extractor for Android layouts - Terraform configuration parser - CI/CD YAML detection and parsing - Maven and Gradle dependency management - Cicd yaml framework detection - Navigation elements: nav_graph, nav_destination, nav_argument, nav_action, nav_deep_link - Relationship types: 30+ types covering imports, calls, tests, annotations, navigation - Business logic traceability (code-to-requirements linking) - Metadata support for confidence scores and element-specific attributes - Integration tests for Android navigation parsing - Performance benchmarks for indexing operations - Fixture files for Android XML, Kotlin patterns, complex scenarios - Android support documentation and query examples - Fixed nav tool schema mismatches - Removed dead code from navigation pipeline - Proper error handling for malformed XML/Kotlin - Consistent qualified name schemes across all languages
Summary
Complete Android/Kotlin navigation system with comprehensive language analysis improvements. Adds Jetpack Compose navigation parsing, annotation extraction, Room/Hilt support, and enhanced call graph resolution.
Key Features
get_nav_graph,find_route,get_screen_args,get_nav_callersChanges
Testing
✅ Squashed into single comprehensive commit for clean history