Skip to content

feat: add Rust crate support via crate: prefix#69

Closed
harlan-zw wants to merge 1 commit intomainfrom
feat/crate-support
Closed

feat: add Rust crate support via crate: prefix#69
harlan-zw wants to merge 1 commit intomainfrom
feat/crate-support

Conversation

@harlan-zw
Copy link
Copy Markdown
Collaborator

Summary

  • Integrates PR feat: crate package support #4's crate support, rebuilt on top of the new prefix parser instead of ad-hoc string checks
  • skilld add crate:<name> resolves from crates.io (docs.rs for versioned URLs, GitHub repo enrichment, llms.txt discovery)
  • Namespaced cache (@skilld-crate/<name>) prevents collisions with npm packages of the same name
  • Shared toStoragePackageName helper applied across prepare/install/status/search-helpers so restore, doc counts, and search indexes resolve crate cache paths correctly

What changed

  • SkillSource gains a crate variant; resolveSkillName('crate:x')'crate:x'
  • New src/sources/crates.ts with rate-limited crates.io client
  • Shared SKILLD_USER_AGENT, createRateLimitedRunner, isLikelyCodeHostUrl, retry-on-429/5xx
  • Lockfile stores crate:<name> identity; cache/symlinks use @skilld-crate/<name> storage
  • Single-package path serializes crate syncs to respect crates.io rate limits; npm batches keep the parallel path
  • Bulk skilld update re-resolves all installed crate skills (cache short-circuits unchanged versions)

Test plan

  • pnpm typecheck — passes
  • pnpm test:run --project unit — 793/793 pass (includes 40 new crate tests)
  • pnpm build — dist emits resolveCrateDocsWithAttempts
  • Smoke test: skilld add crate:serde end-to-end
  • Smoke test: skilld update with an installed crate skill re-resolves against crates.io

Closes #4 (supersedes that PR).

Adds `skilld add crate:<name>` for generating skills from crates.io docs.
Routed through the new prefix parser alongside npm/gh/@-prefixes.

- SkillSource gains a `crate` variant; `resolveSkillName` returns `crate:<name>`
- New resolveCrateDocsWithAttempts hits crates.io, prefers docs.rs for
  versioned URLs, enriches from GitHub when applicable, and discovers llms.txt
- Rate-limited via shared createRateLimitedRunner; SKILLD_USER_AGENT constant
  and retry-on-429/5xx for ofetch consumers
- Storage/identity split: lockfile stores crate:<name>, cache/symlinks use
  @skilld-crate/<name> to avoid colliding with npm packages of the same name
- Single-package path serializes crate syncs (respects crates.io rate limit)
  while npm batches keep the parallel path
- toStoragePackageName applied to prepare/install/status/search-helpers so
  restore, doc counts, and search index lookups resolve crate cache paths
- Bulk `skilld update` now includes all installed crate skills
@harlan-zw
Copy link
Copy Markdown
Collaborator Author

Superseded — pushed the rewrite directly onto #4 so review stays in one place.

@harlan-zw harlan-zw closed this Apr 22, 2026
@harlan-zw harlan-zw deleted the feat/crate-support branch April 22, 2026 14:05
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.

1 participant