opensrc

Fetch source code for npm, PyPI, crates.io, and GitHub/GitLab packages.

Updated Dec 21, 2024
One-click install
npx skills add https://github.com/ryanmiville/dotfiles --skill opensrc
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opensrc
Source: https://github.com/ryanmiville/dotfiles/tree/main/home/.agents/skills/opensrc
Command: npx skills add https://github.com/ryanmiville/dotfiles --skill opensrc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Fetch source code for npm, PyPI, crates.io packages and GitHub/GitLab repos to provide AI agents with deeper implementation context beyond types and docs.

Core Features & Use Cases

  • Fetch sources for npm, PyPI, crates.io, and GitHub/GitLab: obtain actual implementation code to enhance understanding beyond API surfaces.
  • Monorepo & directory support: resolve repository.directory and place code in the appropriate path for multi-package repos.
  • Use Case: AI agents reference real source implementations to debug dependencies and analyze internal patterns in libraries.

Quick Start

Install opensrc globally or use npx: npm install -g opensrc npx opensrc zod npx opensrc pypi:requests npx opensrc crates:serde npx opensrc vercel/ai

Frequently Asked Questions about opensrc

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fetch source code for npm packages to give an AI agent deeper implementation context?

You can fetch source code for npm packages using `npx opensrc [package]` to retrieve actual implementation files and store them locally. This provides AI agents with deeper context beyond standard type definitions and API documentation.

What is the best way to provide an AI agent with a Python library's internal implementation logic?

Fetching the PyPI package source code provides an AI agent with internal implementation logic. Using `npx opensrc pypi:[package]` resolves the registry, detects the version, and downloads the actual source files for analysis.

Does this source code fetcher work with Rust crates.io and GitHub repositories?

Yes, the source code fetcher works with Rust crates.io and GitHub repositories. It applies spec parsing and registry resolution to fetch implementation code from `crates:[package]` and `vercel/ai` style GitHub or GitLab sources.

How do I handle fetching source code from a monorepo with multiple packages?

To handle fetching source code from a monorepo, the tool resolves the repository directory and places the code in the appropriate path. It organizes storage under `opensrc/repos` with a sources index for multi-package repositories.

Do I need to install any dependencies globally to fetch repository source code?

You do not need to install dependencies globally to fetch repository source code. You can use `npx opensrc [package]` directly without prior installation, or optionally install it globally using `npm install -g opensrc`.