opensrc logo

opensrc

Free

Fetch source code for npm packages to give AI coding agents deeper context

Coding AssistantsFreeFree tier
Type
Open Source

About opensrc

opensrc is a command-line tool that gives AI coding agents and developers instant access to the complete source code of any package from multiple registries, including npm, PyPI, crates.io, and GitHub repositories. It resolves a package identifier to a local cached directory, enabling seamless integration with standard Unix commands like rg, grep, cat, ls, and find. The tool fetches source code on first use and caches it locally, returning the cached path instantly on subsequent calls. Output is written to stdout while progress and errors go to stderr, making it safe to use in subshells. It requires Node.js 18+ and Git.

Key Features

Fetches complete source code of packages from multiple registries (npm, PyPI, crates.io, GitHub)
Caches fetched paths locally for instant reuse
Outputs path to stdout and progress to stderr for safe subshell use
Integrates with any CLI tool (rg, grep, cat, ls, find)
Supports package identifiers like 'npm:zod', 'pypi:requests', 'crates:serde', or 'vercel/next.js'
Lightweight, open-source, and designed for AI coding agent workflows

Pros & Cons

Pros
  • Works with any registry (npm, PyPI, crates.io, GitHub repos)
  • Caches results for fast repeated access
  • Simple CLI interface that integrates with standard Unix tools
  • Open source and free to use
  • Designed specifically for AI coding agents, but useful for developers too
Cons
  • Requires Node.js 18+ and Git to be installed
  • Only retrieves source code – no built-in searching or analysis
  • Limited to packages available on supported registries
  • No graphical interface; purely command-line

Best For

Providing AI coding agents with full source context beyond type definitionsSearching package source code with regex tools like ripgrep or grepReading specific source files from installed packagesExploring implementation details of dependencies for debugging or learningAutomating code analysis or documentation generation with scripted access to package source

Alternatives to opensrc