Back to directory
vercel-labs avatar

opensrc

Fetch source code for npm packages to give AI coding agents deeper context. Read more below about its uses, features, and usage.

Clone repository

git clone https://github.com/vercel-labs/opensrc.git

2,966

Stars

194

Forks

12

Watchers

Apache-2.0

License

opensrc

Give coding agents access to any package's source code.

Quick Start

npm install -g opensrc
# Search a package's source
rg "parse" $(opensrc path zod)

# Read a specific file
cat $(opensrc path zod)/src/types.ts

# Works with any registry
find $(opensrc path pypi:requests) -name "*.py"

opensrc path fetches on first use, then returns the cached path instantly. See the CLI readme for full usage.

Packages

Package Description
opensrc CLI — fetch and cache source code from npm, PyPI, crates.io, and GitHub
@opensrc/docs Documentation site

Development

This is a Turborepo monorepo using pnpm workspaces. Use Node.js 24+ and pnpm 11.

pnpm install
turbo build
turbo dev

CLI (Rust)

cargo build --manifest-path packages/opensrc/cli/Cargo.toml
cargo test --manifest-path packages/opensrc/cli/Cargo.toml
cargo fmt --manifest-path packages/opensrc/cli/Cargo.toml
cargo clippy --manifest-path packages/opensrc/cli/Cargo.toml -- -D warnings

Docs (Next.js)

cd apps/docs
pnpm dev

License

Apache-2.0

Releases

Jun 23, 2026

Download .zip

Bug Fixes

Authenticated clone host validation — Parse clone URLs and require exact GitHub, GitLab, and Bitbucket hosts before adding tokens, preventing host-prefix confusion attacks (#66)

Improvemen...

Apr 18, 2026

Download .zip

New Features

opensrc fetch subcommand — Cache a package's source without printing paths, for use in scripts and CI where you just want the source downloaded (#53) Bitbucket Cloud support — Fetch sour...

New Features

Private repo support — Authenticate with GitHub and GitLab private repos via GITHUB_TOKEN and GITLAB_TOKEN environment variables (#38)

Bug Fixes

remove command — Accept the same repo f...

New Features

Rust rewrite — Replace the TypeScript CLI with a native Rust binary for ~10x faster startup Global cache — Switch from per-project opensrc/ folder to a global ~/.opensrc/ cache, shared a...

New Features

Multi-registry support — Fetch source from crates.io and PyPI in addition to npm GitHub/GitLab repo support — Fetch source directly from repositories with owner/repo syntax Private repo...

Contributors

1 contributors by commits. Profile dekhne ke liye kisi bhi developer par click karein.