Registry / devops / opensrc

opensrc

JSON →
library0.7.2jsnpmunverified

CLI tool for fetching and caching source code of packages from npm, PyPI, crates.io, and GitHub/GitLab/Bitbucket repositories. v0.7.2 (active). Resolves packages from registry APIs, shallow-clones at correct version tags from lockfiles, and caches globally at ~/.opensrc/. Key differentiator: gives AI coding agents offline, structured access to raw source code without runtime dependencies per invocation (native Rust binary). Supports multiple registries with prefix syntax and concurrent fetching.

npm install opensrc
INSTALL
IMPORT
SIG · OPENSRC
O
opensrc
devopsjavascriptv0.7.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

cli
npx opensrc path zod
npm install opensrc --save-dev
Intended as global CLI; not a library import. Use npx or global install.
path command
opensrc path zod
opensrc zod
The 'path' subcommand is required to resolve and fetch source.
registry prefix
opensrc path pypi:requests
opensrc path requests
Default registry is npm; use 'pypi:' prefix for Python packages.

Shows global installation, fetching a package path, using with tools like ripgrep, multiple packages, and registry prefixes.

# Install globally (recommended) npm install -g opensrc # Fetch and print path to zod source opensrc path zod # Output: /home/user/.opensrc/repos/github.com/colinhacks/zod/v3.22.0 # Use with grep or cat rg "ZodError" $(opensrc path zod@3.22.0) cat $(opensrc path zod)/src/types.ts # Fetch multiple packages rg "parse" $(opensrc path zod react next) # PyPI example ls $(opensrc path pypi:flask@3.0.0)/src/flask/
Debug
Known issues
gotchaRequires global install (npm install -g) to avoid Node.js overhead per invocation. Using npx will still download and run the binary but may add startup delay.
fix
Prefer npm install -g opensrc over npx for repeated use.
affects: >=0.0.0
gotchaDefault registry is npm. For non-npm packages, prefix (e.g., pypi:, crates:) is required. Omitting prefix defaults to npm.
fix
Use explicit prefix: opensrc path pypi:requests.
affects: >=0.0.0
gotchaVersion resolution from lockfiles only works for npm (package-lock.json, yarn.lock, pnpm-lock.yaml). Other registries use latest version unless explicitly specified with @version.
fix
Specify version explicitly for non-npm packages: opensrc path crates:serde@1.0.0
affects: >=0.0.0
gotchaCache directory is ~/.opensrc by default, can be changed via OPENSRC_HOME environment variable. Ensure sufficient disk space.
fix
Set OPENSRC_HOME=/path/to/cache before running opensrc.
affects: >=0.0.0
Errors
Common errors & fixes
command not found: opensrc
opensrc not installed globally or not in PATH.
fix
Run 'npm install -g opensrc' and ensure npm global bin directory is in your PATH (e.g., export PATH=$(npm bin -g):$PATH).
Error: Package 'requests' not found
Default registry is npm; 'requests' is a PyPI package.
fix
Use prefix: 'opensrc path pypi:requests'.
Error: version tag not found for zod@9.9.9
Specified version does not exist on the registry.
fix
Check available versions: 'npm view zod versions' or use a valid semver range.
Upgrade
Version history
0.7.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
8
Amazon
1
Resources
opensrc — npm install opensrc · libregistry