Skip to content
This repository was archived by the owner on Sep 23, 2025. It is now read-only.
This repository was archived by the owner on Sep 23, 2025. It is now read-only.

Extension: Basic crate search via crates.io API #2

Description

@nikomatsakis

Overview

Add ability to search for crates on crates.io using text-based queries, complementing the existing example search functionality.

Proposed API

// Search by keywords, description, etc.
let crates = Eg::search_crates("web framework").await?;
let crates = Eg::search_crates("async http client").await?;

// Browse by category
let crates = Eg::browse_category("web-programming").await?;

// Combined workflow: discover crates, then search examples
let web_frameworks = Eg::search_crates("web framework").await?;
for crate_info in web_frameworks.iter().take(5) {
    let examples = Eg::rust_crate(&crate_info.name)
        .pattern(r"route")?
        .search().await?;
}

Implementation

  • Use existing crates_io_api dependency
  • Add search endpoints: /api/v1/crates with query parameters
  • Return structured CrateInfo with name, description, downloads, etc.
  • Integrate with existing builder pattern

Benefits

  • Crate discovery: Find relevant crates before diving into examples
  • LLM workflow: "Find HTTP clients, then show me retry examples"
  • Exploration: Browse categories and popular crates
  • Foundation: Sets up infrastructure for more advanced search features

Acceptance Criteria

  • Text-based crate search with keyword matching
  • Category browsing support
  • Structured results with crate metadata
  • Integration with existing example search workflow
  • Comprehensive error handling for API failures

Out of Scope

  • Semantic/embedding-based search (separate issue)
  • Local caching of crate metadata
  • Advanced filtering/sorting options

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions