Skip to content

feat(indexer): add Android/Kotlin extractors#29

Closed
hossihub wants to merge 7 commits intoFreePeak:mainfrom
hossihub:dev
Closed

feat(indexer): add Android/Kotlin extractors#29
hossihub wants to merge 7 commits intoFreePeak:mainfrom
hossihub:dev

Conversation

@hossihub
Copy link
Copy Markdown
Contributor

Summary

  • Add Android/Kotlin extractors for WorkManager, CoroutineDispatcher, ViewModel, Repository
  • Rewrite MCP instructions as decision flowchart
  • Add clippy allow for regex creation in loops
  • Bump version to 0.16.8

…neDispatcher, ViewModel/Repository

- Add WorkManager pattern extraction (Worker, CoroutineWorker, OneTime/PeriodicWorkRequest)
- Add coroutine dispatcher usage extraction (Dispatchers.IO/Main/Default, withContext)
- Add ViewModel/Repository relationship detection
- Enhanced JetpackNavExtractor: proper line numbers, block-aware argument assignment
- Fix greedy regex in android_hilt (.+ → [^={n]+)
- Add 7 new RelationshipType variants (HiltBindsInterface, ViewModelOwnsRepository, etc.)
Copy link
Copy Markdown
Member

@linhdmn linhdmn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MR Overview

  • Title: feat(indexer): add Android/Kotlin extractors
  • Author: hossihub
  • Branch: dev → main

1. Logic Review

Issues Found

  • File: src/indexer/kotlin_annotations.rs

    • Severity: warning
    • Issue: The Kotlin annotation extractor handles @ViewModel, @Repository, @WorkManager, @CoroutineDispatcher, @IntentService but implementation details for WorkManager and IntentService need verification against actual annotation patterns.
    • Suggestion: Add integration tests that parse real Kotlin files with these annotations to ensure correct extraction.
  • File: instructions/agents-template.md (deleted)

    • Severity: info
    • Issue: Removing agent instructions is fine since LeanKG is the single source of truth per CLAUDE.md.
    • Suggestion: No action needed.

2. Scope Validation

In Scope: src/indexer/kotlin_annotations.rs, Cargo.toml version bump
⚠️ Note: Instructions files deleted - align with project documentation strategy

3. Impact Analysis

  • New Files: src/indexer/kotlin_annotations.rs
  • Modified Files: Cargo.toml, Cargo.lock
  • Risk Level: medium (new feature, additive changes)
  • Affected Modules: indexer module

4. Suggested Description Update

## Scope of Changes

### Files Changed
- `src/indexer/kotlin_annotations.rs` - New extractor for Kotlin annotations (ViewModel, Repository, WorkManager, CoroutineDispatcher, IntentService)
- `Cargo.toml` - Bump version to 0.16.8
- `instructions/` - Removed (LeanKG provides this context)

### Impact Analysis
- **Affected Modules:** indexer
- **Risk Level:** medium
- **New Dependencies:** None

hossihub and others added 3 commits April 28, 2026 19:33
…e annotation patterns

- Add test_extract_hilt_worker_annotations: verifies @HiltWorker and @AssistedInject
  extracted from CoroutineWorker subclass primary constructor
- Add test_extract_intent_service_annotations: verifies @androidentrypoint extracted
  from IntentService subclass
- Add test_extract_workmanager_assisted_params: verifies @assisted on constructor params

Fix: extend visit_node to collect annotations on primary_constructor and its parameters —
these were silently dropped because primary_constructor had no target_type match.
@linhdmn
Copy link
Copy Markdown
Member

linhdmn commented Apr 29, 2026

Merged - commits are in main

@linhdmn linhdmn closed this Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants