Problem
On a Swift iOS app (single app target, ~1450 Swift files), codemap --deps produces almost no edges. Example output on an integrations directory:
CustomerIO ═════════════════════════════════════════════════
+4 standalone files
7 files · 15 functions · 0 deps
Coverage: partial — Swift (7 files): imports name modules, not files, and same-package files need no import: intra-project edges need symbol-reference resolution and are not represented
The coverage note is honest about why: Swift import statements name modules, and files in the same target reference each other with no import at all. So for the dominant iOS repo shape (one big app target), --deps can't answer the question it's best at elsewhere: "who touches this hub file?"
Concrete miss: an analytics facade file (Analytics.swift-style, enum + static funcs) called from ~20 view/viewmodel files across the target shows as a standalone node with zero importers, and --importers on it reports "No files import this file." Grep remains the sharper tool for exactly the hub-impact question codemap is designed for.
Suggestion
Intra-target edges need symbol-reference resolution rather than import parsing. Options, roughly in order of effort:
- ast-grep-based identifier matching (already a dependency for
--deps): index top-level declared symbols per file (types, top-level funcs, enum names), then scan other files in the same target for references to those identifiers. Heuristic but catches the common TypeName.member / initializer-call patterns that make up most Swift cross-file references.
- SourceKit / indexstore-db: read the compiler's index store (
.build/DerivedData Index.noindex) when present — exact references, but requires a prior build and adds a heavyweight dependency.
Even the heuristic version (1) would move Swift coverage from "module imports only" to useful hub detection, and false positives are acceptable for a brain-map tool — over-connecting a hub is better than showing it standalone.
Environment
- codemap 4.5.1 (Homebrew, jordancoin/tap)
- macOS, Swift/Xcode project, single app target + test target
Problem
On a Swift iOS app (single app target, ~1450 Swift files),
codemap --depsproduces almost no edges. Example output on an integrations directory:The coverage note is honest about why: Swift
importstatements name modules, and files in the same target reference each other with no import at all. So for the dominant iOS repo shape (one big app target),--depscan't answer the question it's best at elsewhere: "who touches this hub file?"Concrete miss: an analytics facade file (
Analytics.swift-style,enum+ static funcs) called from ~20 view/viewmodel files across the target shows as a standalone node with zero importers, and--importerson it reports "No files import this file." Grep remains the sharper tool for exactly the hub-impact question codemap is designed for.Suggestion
Intra-target edges need symbol-reference resolution rather than import parsing. Options, roughly in order of effort:
--deps): index top-level declared symbols per file (types, top-level funcs, enum names), then scan other files in the same target for references to those identifiers. Heuristic but catches the commonTypeName.member/ initializer-call patterns that make up most Swift cross-file references..build/DerivedDataIndex.noindex) when present — exact references, but requires a prior build and adds a heavyweight dependency.Even the heuristic version (1) would move Swift coverage from "module imports only" to useful hub detection, and false positives are acceptable for a brain-map tool — over-connecting a hub is better than showing it standalone.
Environment