go.mod, pyproject.toml, tsconfig.json, composer.json, pom.xml, build.gradle.kts, .csproj, Package.swift) to derive module paths and source roots for cross-file relationship tracking and import resolution.
How It Works
- Config Discovery: Codanna reads project files (go.mod, pyproject.toml, composer.json, etc.)
- Rule Extraction: Module prefixes, source roots, and namespace mappings are extracted
- Path Resolution: File paths are mapped to module paths during indexing
- Cache Management: Rules are cached in
.codanna/index/resolvers/with SHA-based invalidation
codanna index when config file contents change.
Configuration
Add config files tosettings.toml:
Go
Readsgo.mod to extract the module name and resolve import paths.
- File:
internal/handlers/user.go - Module:
github.com/user/repo - Result:
github.com/user/repo/internal/handlers
Python
Multi-backend support for Python’s build ecosystem. Codanna detects the backend from[build-system].build-backend in pyproject.toml.
Supported Backends
If no backend-specific config is found, Codanna auto-discovers packages by scanning for
__init__.py files.
Kotlin
Readsbuild.gradle.kts to detect source roots based on project layout.
Kotlin Multiplatform projects use different source layouts. Specify
source_layout explicitly when auto-detection produces incorrect paths.Source Layouts
Multi-Project Configuration
Java
Reads Mavenpom.xml or Gradle build.gradle to detect source roots.
Java projects use the same layout system as Kotlin. Specify
source_layout when the project uses non-standard source directories.Multi-Project Configuration
- File:
src/main/java/org/example/service/UserService.java - Result:
org.example.service.UserService
PHP
Reads PSR-4 autoload configuration fromcomposer.json.
- File:
src/Http/Controllers/UserController.php - Namespace:
App\Http\Controllers\UserController
C#
Reads SDK-style.csproj files to extract namespace configuration.
RootNamespace- default namespace for the projectAssemblyName- output assembly name
TypeScript
Readstsconfig.json to resolve path aliases and baseUrl settings.
- Path aliases (
@app/*,@components/*) - baseUrl resolution
- Project references
Swift
Reads Swift Package ManagerPackage.swift to detect source roots.
Sources/, Tests/) or custom path: specifications from target definitions.
Resolution example:
- File:
Sources/Networking/Client.swift - Module:
Networking
Verifying Resolution
After indexing, verify resolution with:Next Steps
Relationships
Track callers, calls, and type dependencies.
Language Support
Supported languages and filters.