opensrc  by vercel-labs

Fetching npm package source code for AI coding agents

Created 1 month ago
348 stars

Top 80.2% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

Summary

opensrc is a CLI tool that fetches source code for npm packages and public GitHub repositories, providing AI coding agents with deeper implementation context beyond types and documentation. It targets developers using AI assistants, enabling agents to better understand package internals for improved code comprehension and generation.

How It Works

opensrc queries the npm registry for repository URLs, detects installed package versions from lockfiles (e.g., package-lock.json), and clones the corresponding Git repository tag. Sources are stored locally in opensrc/. Optionally, it integrates with the project by adding opensrc/ to .gitignore, excluding it from tsconfig.json, and updating AGENTS.md, simplifying agent access.

Quick Start & Requirements

  • Primary install / run command: npm install -g opensrc or npx opensrc <package>.
  • Prerequisites: Node.js and npm/npx.
  • Setup: Initial runs may prompt for project file modifications (.gitignore, tsconfig.json, AGENTS.md); use --modify to bypass.
  • Links: Usage examples provided directly in README.

Highlighted Details

  • Fetches source code for npm packages and public GitHub repositories.
  • Auto-detects installed package versions from lockfiles for consistency.
  • Supports fetching multiple packages and repositories simultaneously.
  • Manages fetched sources via list and remove commands.
  • Optional automatic project file modifications for AI agent integration.

Maintenance & Community

The provided README does not detail specific contributors, community channels, sponsorships, or a roadmap.

Licensing & Compatibility

  • License type: Apache-2.0.
  • Compatibility: Permissive license suitable for commercial use and closed-source projects.

Limitations & Caveats

Requires user confirmation for project file modifications unless --modify is used. Effectiveness depends on the availability and structure of public npm package repositories and GitHub sources.

Health Check
Last Commit

1 week ago

Responsiveness

Inactive

Pull Requests (30d)
6
Issues (30d)
3
Star History
208 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.