Context / Motivation
I was about to build a lightweight Rust discovery tool (syn‑based, no typecheck) and found rs‑hack.
It already solves AST‑aware search/refactor. I asked Codex to list the discovery operations it
struggles with. The proposals below are purely Codex‑generated from a longer conversation, not a
human gap analysis. If they align with your vision, I’m happy to implement PRs (I whatever agent we use would make a reasonably good pass at implementing these ideas).
What rs‑hack already covers
find with --node-type / --kind / --limit is excellent
- JSON output already exists for
find
- No typecheck required
Proposed discovery commands (with examples + output)
describe — type‑centric summary
Current: multiple find calls + manual stitching.
Command:
rs-hack describe --type FileSearchPopup --paths src --calls
Output (example):
Type: FileSearchPopup (struct)
Defined at: tui/src/file_search.rs:12
Fields: query, results, state
Impls: FileSearchPopup, Default
Methods: set_query, clear, on_result
Call sites (set_query): 3
- tui/src/app.rs:145
- tui/src/file_search.rs:98
Value: replaces 4–6 find/rg steps with one “what is this type?” command.
owners — field embedding graph
Current: find --node-type struct + manual scan.
Command:
rs-hack owners --type FileSearchPopup --paths src
Output:
Owners of FileSearchPopup:
AppState::file_search (tui/src/app.rs:55)
UiState::popup (tui/src/ui_state.rs:18)
Value: instantly shows where a type lives in state.
callsites — method calls scoped to receiver type
Current: find --node-type method-call --name set_query (unscoped).
Command:
rs-hack callsites --method set_query --type FileSearchPopup --paths tui
Output:
Calls to FileSearchPopup::set_query (3):
tui/src/app.rs:145 self.file_search.set_query(...)
tui/src/file_search.rs:98 popup.set_query(...)
Value: avoids irrelevant results from other types with same method name.
impls — trait implementors
Current: manual find across impl blocks.
Command:
rs-hack impls --trait HistoryCell --paths tui
Output:
Trait HistoryCell implemented by:
CodeCell (tui/src/history/cells/code.rs:12)
TextCell (tui/src/history/cells/text.rs:9)
Value: one‑shot answer to “who implements this trait?”
summary — module inventory
Current: multiple find calls, manual summary.
Command:
rs-hack summary --path tui/src/history_cell.rs
Output:
Module: tui/src/history_cell.rs
Public items: HistoryCell, RenderedCell
Types: 2 structs, 1 enum
Functions: render_cell, measure_cell
Re-exports: pub use cells::*
Doc: "History rendering entrypoints."
Value: 1‑line “what’s in this module?”
doc-coverage — missing docs list
Current: no doc coverage command.
Command:
rs-hack doc-coverage --path tui/src --fields
Output:
Missing docs (items): 12
Missing docs (fields): 31
Top offenders:
tui/src/app.rs: AppState
tui/src/history_cell.rs: RenderedCell::width
Value: makes doc passes actionable.
neighbors — related modules
Current: manual file navigation.
Command:
rs-hack neighbors --path tui/src/file_search.rs
Output:
Neighbors for tui/src/file_search.rs:
Siblings: tui/src/file_search_tests.rs, tui/src/file_search_state.rs
Twin dirs: tui2/src/file_search.rs
Tests: tui/tests/file_search.rs
Value: quickly surfaces adjacent context, test files, or “tui ↔ tui2” pairs.
xref — cross‑reference map for a symbol
Current: multiple find calls grouped by hand.
Command:
rs-hack xref --name FileSearchPopup --paths tui
Output:
Definition:
tui/src/file_search.rs:12 (struct)
Impls:
tui/src/file_search.rs:55
Methods:
set_query, clear, on_result
Uses:
tui/src/app.rs:145 (field)
tui/src/ui_state.rs:18 (field)
Value: single structured view of definition + usage.
relate — relationships view
Current: find --field-name and find --node-type match-arm manually assembled.
Command:
rs-hack relate --type AppState --paths tui
Output:
Fields + reads/writes (top 5):
file_search (writes: 6, reads: 12)
history (writes: 2, reads: 20)
And for enums:
rs-hack relate --enum View --paths tui
Output:
Enum View variants:
List, Popup, Empty
Match coverage:
handle_view: missing Popup
render_view: complete
Value: gives dataflow and match coverage quickly.
calls — local call graph
Current: find --node-type function-call + manual trace.
Command:
rs-hack calls --fn render_view --paths tui --depth 1
Output:
render_view calls:
render_list
render_popup
Value: local call graph without LSP.
type-usage — positional usage stats
Current: find --node-type type-ref only.
Command:
rs-hack type-usage --type FileSearchPopup --paths tui
Output:
Usage of FileSearchPopup:
fields: 2
function args: 1
return types: 0
trait bounds: 0
Value: shows whether a type is API boundary or internal.
struct-audit — literal coverage
Current: find --node-type struct-literal only.
Command:
rs-hack struct-audit --type FileSearchPopup --paths tui
Output:
Struct literal audit: FileSearchPopup
3 literals found
missing fields: state (2 literals)
Value: “where is this constructed and what’s missing?”
match-audit — missing enum variants
Current: find --node-type match-arm only.
Command:
rs-hack match-audit --enum View --paths tui
Output:
Missing variants:
render_view: Popup
handle_view: Popup
Value: complements add-match-arm with discovery.
snippet — context‑sized extraction
Current: find --format snippets only.
Command:
rs-hack snippet --name FileSearchPopup --node-type struct --context 3
Output:
tui/src/file_search.rs:12
/// Popup state for file search UI.
pub struct FileSearchPopup {
query: String,
results: Vec<SearchResult>,
state: PopupState,
}
Value: fast skimming without opening files.
describe presets
Current: manual multi‑step flows.
Command:
rs-hack explain type FileSearchPopup --paths tui
Output: wrapper around describe + owners + callsites with a concise summary.
Request
Would you consider adding a small set of discovery‑first commands (implemented as thin wrappers on
top of find/--kind/--node-type)? I’m happy to help implement these.
Context / Motivation
I was about to build a lightweight Rust discovery tool (syn‑based, no typecheck) and found rs‑hack.
It already solves AST‑aware search/refactor. I asked Codex to list the discovery operations it
struggles with. The proposals below are purely Codex‑generated from a longer conversation, not a
human gap analysis. If they align with your vision, I’m happy to implement PRs (I whatever agent we use would make a reasonably good pass at implementing these ideas).
What rs‑hack already covers
findwith--node-type/--kind/--limitis excellentfindProposed discovery commands (with examples + output)
describe— type‑centric summaryCurrent: multiple
findcalls + manual stitching.Command:
Output (example):
Value: replaces 4–6
find/rg steps with one “what is this type?” command.owners— field embedding graphCurrent:
find --node-type struct+ manual scan.Command:
Output:
Value: instantly shows where a type lives in state.
callsites— method calls scoped to receiver typeCurrent:
find --node-type method-call --name set_query(unscoped).Command:
Output:
Value: avoids irrelevant results from other types with same method name.
impls— trait implementorsCurrent: manual
findacross impl blocks.Command:
Output:
Value: one‑shot answer to “who implements this trait?”
summary— module inventoryCurrent: multiple
findcalls, manual summary.Command:
Output:
Value: 1‑line “what’s in this module?”
doc-coverage— missing docs listCurrent: no doc coverage command.
Command:
Output:
Value: makes doc passes actionable.
neighbors— related modulesCurrent: manual file navigation.
Command:
Output:
Value: quickly surfaces adjacent context, test files, or “tui ↔ tui2” pairs.
xref— cross‑reference map for a symbolCurrent: multiple
findcalls grouped by hand.Command:
Output:
Value: single structured view of definition + usage.
relate— relationships viewCurrent:
find --field-nameandfind --node-type match-armmanually assembled.Command:
Output:
And for enums:
Output:
Value: gives dataflow and match coverage quickly.
calls— local call graphCurrent:
find --node-type function-call+ manual trace.Command:
Output:
Value: local call graph without LSP.
type-usage— positional usage statsCurrent:
find --node-type type-refonly.Command:
Output:
Value: shows whether a type is API boundary or internal.
struct-audit— literal coverageCurrent:
find --node-type struct-literalonly.Command:
Output:
Value: “where is this constructed and what’s missing?”
match-audit— missing enum variantsCurrent:
find --node-type match-armonly.Command:
Output:
Value: complements
add-match-armwith discovery.snippet— context‑sized extractionCurrent:
find --format snippetsonly.Command:
Output:
Value: fast skimming without opening files.
describepresetsCurrent: manual multi‑step flows.
Command:
Output: wrapper around
describe+owners+callsiteswith a concise summary.Request
Would you consider adding a small set of discovery‑first commands (implemented as thin wrappers on
top of
find/--kind/--node-type)? I’m happy to help implement these.