code navigator
toolingsearchrefactorshell
/install muscle code-navigator Run in a Soma session to add to your project.
curl -sO https://raw.githubusercontent.com/meetsoma/community/main/muscles/code-navigator.md Download and copy to .soma/muscles/code-navigator.md — or view on GitHub ↗
Details
Code Navigator
TL;DR
soma-code.sh — fast codebase navigator. 11 commands: find (grep with file:line), lines (exact line range), map (function/class index for TS/JS/Bash/CSS), refs (def vs use classification), replace (line-specific sed), structure (file tree + sizes), tsc-errors (TypeScript errors with context), physics (motion/animation audit), events (listeners/dispatchers), css-vars (custom property audit), config (settings objects). Use map before editing any file. Use refs before renaming. Use find instead of raw grep -rn. Default target: project root.
Commands
| Command | Use When | Example |
|---|---|---|
find <pattern> [path] [ext] |
Searching codebase — replaces grep -rn |
soma-code.sh find "loadAllContent" |
lines <file> <start> [end] |
Reading exact lines (default: 20 lines) | soma-code.sh lines core/body.ts 580 620 |
map <file> |
Before editing — function/class layout | soma-code.sh map core/prompt.ts |
refs <symbol> [path] |
Before renaming — DEF vs USE sites | soma-code.sh refs "compileWithTemplate" |
replace <file> <line> <old> <new> |
Surgical line-specific replacement | soma-code.sh replace core/body.ts 45 "old" "new" |
structure [path] |
File tree with sizes | soma-code.sh structure repos/agent/core |
tsc-errors [path] |
TypeScript errors with code context | soma-code.sh tsc-errors repos/agent |
physics [path] |
Audit motion/animation/scroll code | soma-code.sh physics src/ |
events [path] |
Find event listeners and dispatchers | soma-code.sh events src/ |
css-vars [path] |
CSS custom property definitions + usages | soma-code.sh css-vars src/ |
config [path] |
Find config/options/settings objects | soma-code.sh config src/ |
When to Reach for This
- Before editing a file →
mapgives the function index with line numbers - Before renaming anything →
refsshows every def and usage site - Before searching →
findinstead of rawgrep -rn(better output format) - Before refactoring →
map+refs+structureto understand the shape, thenincremental-refactormuscle for the process - After CSS changes →
css-varsto verify no orphaned variables - After TypeScript changes →
tsc-errorsfor errors with code context (better than rawtsc)
Language Support (map command)
| Language | What it finds |
|---|---|
| TypeScript/JavaScript | export, function, class, interface, type, enum, const, methods, getters/setters |
| Bash | Functions name(), case labels, section comments (# ──) |
| CSS | Selectors, @-rules, section comments |
Relationship to Other Tools
- soma-code.sh = understand the code (find, map, refs)
- soma-refactor.sh = change the code safely (scan blast radius, verify, risk score)
- soma-find.sh = search beyond code (vault, archives, other projects)
- soma-seam.sh = trace concepts through memory (sessions, docs, seams)