Conversation
Add visit_item_const, visit_item_static, and visit_item_union to the ItemVisitor so rspeek can find these item kinds in dependency and workspace crates. Includes tests for const, static, union indexing and pub_only filtering.
When listing a crate's items with `rspeek <crate>`, the output now includes direct dependencies and workspace members that aren't yet deps. Helps LLMs discover what's already available before writing code from scratch. Crate name comparison normalizes hyphens/underscores to avoid false positives in the available list.
39466f5 to
456fc4e
Compare
There was a problem hiding this comment.
Pull request overview
This PR expands rspeek’s item indexing to include union, const, and static, and enhances the crate-overview output to include direct dependencies plus a list of workspace member crates.
Changes:
- Index
union,const, andstaticitems (with new unit tests). - Add dependency + “available workspace members” fields to crate overview output (text + JSON).
- Update CLI help/README to reflect the expanded item support and overview output.
Reviewed changes
Copilot reviewed 6 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/index.rs |
Adds syn visitor support for union/const/static and introduces tests for these kinds. |
src/resolve.rs |
Extends ResolvedCrate with direct dependency names and adds Workspace::member_names(). |
src/main.rs |
Emits new overview fields in both JSON and text modes and updates --llm-help docs. |
src/output.rs |
Extends JsonCrateOverview JSON schema with deps and available_workspace_members. |
README.md |
Documents new supported item kinds and the enriched crate overview output. |
Cargo.toml |
Adds tempfile as a dev-dependency for new tests. |
Cargo.lock |
Lockfile updates from adding tempfile. |
.gitignore |
Ignores .kiro/. |
Comments suppressed due to low confidence (2)
src/main.rs:210
available_workspace_membersis computed for every crate being overviewed. For non-workspace-member crates (i.e., registry dependencies), this will list essentially all workspace members because they’re not deps of that external crate, which makes the label “not yet deps” misleading. Consider only populating this field whenc.is_workspace_member(otherwise leave it empty), or redefine it to be relative to a specific workspace crate.
crate_name: c.name.clone(),
crate_version: c.version.clone(),
src_dir: c
.source_dirs
.iter()
.map(|d| d.display().to_string())
src/main.rs:252
- Same issue as the JSON branch: this computes and prints “Workspace members (not yet deps)” even when the crate being overviewed is not a workspace member, which can produce confusing output for registry crates. Gate this on
c.is_workspace_member(or make the notion of “available members” relative to a chosen workspace crate).
let items = index::list_items(&c.source_dirs, pub_only, c.out_dir.as_deref())
.map_err(|e| NotFound {
message: e.to_string(),
suggestions: vec![],
})?;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let out_dir = find_out_dir(metadata.target_directory.as_std_path(), &pkg.name); | ||
| let deps: Vec<String> = node.deps.iter().map(|d| d.name.clone()).collect(); | ||
| crates.push(ResolvedCrate { |
There was a problem hiding this comment.
node.deps from cargo_metadata includes dependency edges with kinds (normal/dev/build). Collecting only d.name here can cause the displayed deps list to include build- and dev-dependencies, which aren’t usable from the crate’s main code. If the intent is “what’s already usable in code,” filter to normal deps via dep_kinds, or include the kind in the stored data/output so the UI can distinguish them.
No description provided.