Skip to content

feat: codemap find, Swift type-reference edges, self-healing config, output standard - #189

Merged
JordanCoin merged 7 commits into
mainfrom
feat/find-swift-config
Sep 11, 2026
Merged

feat: codemap find, Swift type-reference edges, self-healing config, output standard#189
JordanCoin merged 7 commits into
mainfrom
feat/find-swift-config

Conversation

@JordanCoin

Copy link
Copy Markdown
Owner

What

Four pieces, built from issue #187 (learn from zvec-grep) and from testing codemap on five repos of different stacks.

codemap find "<query>" (+ MCP tool find)

Ranked lexical search over what the scanner already extracts: path segments, function names, and (now) Swift type names. BM25 plus an exact-word bonus. Every hit carries its importer count and hub flag, then the coverage line. No new dependencies.

$ codemap -C ~/Code/Bell find "session patient timer" --limit 2
Bell/Models/Patient/Session.swift
  matched: Session.swift, sessionDictionary, Session
  importers: 22 (hub)
Bell/Controller/Home/HomeViewController.swift
  matched: presentFinishedSessionPanel, finishedSessionSaved, prepNextSession
  importers: 5 (hub)
Coverage: partial — Swift (86 files): intra-project edges resolved by type-name reference; ...

Lexical only, and it says so. Stemming and embeddings deliberately skipped until real queries miss.

Swift intra-project edges

Swift was symbol-level: no file-to-file edges, coverage unavailable. New ast-grep swift-types rule extracts declared types into FileAnalysis.Types; the graph builder resolves type-name references per file with a word-boundary scan (imports stripped, class func excluded). Coverage source becomes mixed with the reason stated.

On Bell (86 Swift files): 16 edges before, 230 after. Real hubs surface: Client (23), Session (22), Firebase (20).

Known ceiling, marked with a ponytail: comment: name match, not symbol resolution. An enum of accessibility IDs referenced everywhere counts as a hub.

Self-healing config

Any analysis entry point writes an auto-detected .codemap/config.json when one is missing inside a git checkout. Init now adds excludes for noise present in the repo and sets mode, so fresh repos assess ready. When a config is still boilerplate, session-start and prompt-submit print a stop line telling the agent to finish setup before the task, and the config-setup skill opens with that loop.

Output standard

docs/OUTPUT-STANDARD.md: every printed line must be sourced, precise, bounded, useful. Linked from CONTRIBUTING with the review rule.

Verification

  • go test ./... green across all packages.
  • Exercised on codemap, docling (Python), openfoia (Python), community-os (Rust/Go/TS), Bell (Swift).
  • codemap find "q" --limit N accepts flags after the query.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T

JordanCoin and others added 7 commits September 11, 2026 14:32
… counts

Lexical BM25 over what the scanner already extracts (paths and function
names, split on camelCase, snake_case and separators), plus a whole-word
bonus. Each hit carries importer count and hub status from the same file
graph the other commands use, and ends with the coverage line. Exposed as
the `find` MCP tool as well. No new dependencies, no index on disk.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
Swift files never import each other, so the graph over a Swift app was
structurally empty and every Swift file read as having zero dependents.
Extract declared class/struct/enum/actor/protocol names per file, then
add an edge from any Swift file that mentions a type another file
declares. Import lines are stripped first so a project enum named like a
module does not gain the whole app as importers, and the declaration
keyword must head the match so "class func" is never read as a type.

The symbol-imports/swift source now reports mixed with a note naming the
resolver and its blind spots; coverage stays partial. Kotlin, Java, C#
and Scala are unchanged. On an 86-file Swift app the graph goes from 16
module-level edges to 230 file edges.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
Every analysis entry point (tree, deps, importers, blast-radius, collide,
session-start and prompt-submit hooks) now writes an auto-detected
.codemap/config.json when none exists and the root is a git checkout.
Remote clones and non-git roots are never written.

config init now excludes noise that is actually present (Carthage,
coverage, fixtures, __snapshots__, .xcassets, and binary asset
extensions in volume), keeps those extensions out of `only`, and writes
mode explicitly so a fresh init assesses as ready instead of boilerplate.

When setup is still missing, empty, malformed, or boilerplate, hooks
print an imperative stop line and a Run now instruction; the config-setup
skill opens with the fix-first loop.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
…etup in prompt-submit

- find now tokenizes FileAnalysis.Types so Swift type names rank
- find auto-inits config like the other analysis entry points
- codemap find "q" --limit N works with flags after the query
- prompt-submit prints the stop line when config-setup is injected at 100

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
Sourced, precise, bounded, useful. Linked from CONTRIBUTING.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NRaBgKRAZMX9hjbkkefA7T
Copilot AI lite review requested due to automatic review settings September 11, 2026 21:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@JordanCoin
JordanCoin merged commit 9b6ace7 into main Sep 11, 2026
12 checks passed
@JordanCoin
JordanCoin deleted the feat/find-swift-config branch September 11, 2026 21:16
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