npx skills add https://github.com/third774/dotfiles --skill opensrc用于获取包/仓库源代码的 CLI 工具,为 AI 编码代理提供更深入的实现上下文。
# 全局安装或使用 npx
npm install -g opensrc
# 获取 npm 包(自动从 lockfile 检测已安装版本)
npx opensrc zod
# 从其他注册表获取
npx opensrc pypi:requests # Python/PyPI
npx opensrc crates:serde # Rust/crates.io
# 直接获取 GitHub 仓库
npx opensrc vercel/ai # owner/repo 简写
npx opensrc github:owner/repo # 显式前缀
npx opensrc https://github.com/colinhacks/zod # 完整 URL
# 获取特定版本/引用
npx opensrc zod@3.22.0
npx opensrc owner/repo@v1.0.0
| 命令 | 描述 |
|---|---|
opensrc <packages...> | 获取包/仓库的源代码 |
opensrc list |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 列出所有已获取的源代码 |
opensrc remove <name> | 移除特定的源代码 |
opensrc clean | 移除所有源代码 |
获取后,源代码存储在 opensrc/ 目录中:
opensrc/
├── settings.json # 用户偏好设置
├── sources.json # 已获取包/仓库的索引
└── repos/
└── github.com/
└── owner/
└── repo/ # 克隆的源代码
首次运行时,opensrc 会提示修改:
.gitignore - 将 opensrc/ 添加到忽略列表tsconfig.json - 将 opensrc/ 从编译中排除AGENTS.md - 添加指向源代码的章节使用 --modify 或 --modify=false 可以跳过提示。
node_modules、package-lock.json、pnpm-lock.yaml 或 yarn.lock 检测已安装版本repository.directory 字段处理 monorepo 中的包--depth 1 进行高效克隆,克隆后移除 .gitv{version}、{version},然后是默认分支# 代理需要理解 zod 的实现
npx opensrc zod
# → 从 lockfile 检测版本
# → 从 npm 注册表查找仓库 URL
# → 在匹配的 git 标签处克隆
# → 源代码位于 opensrc/repos/github.com/colinhacks/zod/
# 重新运行相同命令以更新到当前安装的版本
npx opensrc zod
# → 检查版本是否更改
# → 如果需要则重新克隆
# 一次性获取多个
npx opensrc react react-dom next
npx opensrc zod pypi:pydantic vercel/ai
详细信息请参阅:
每周安装量
78
仓库
GitHub 星标数
3
首次出现
2026年1月25日
安全审计
安装于
codex78
gemini-cli77
opencode77
kimi-cli76
github-copilot76
amp76
CLI tool to fetch source code for packages/repos, giving AI coding agents deeper implementation context.
# Install globally or use npx
npm install -g opensrc
# Fetch npm package (auto-detects installed version from lockfile)
npx opensrc zod
# Fetch from other registries
npx opensrc pypi:requests # Python/PyPI
npx opensrc crates:serde # Rust/crates.io
# Fetch GitHub repo directly
npx opensrc vercel/ai # owner/repo shorthand
npx opensrc github:owner/repo # explicit prefix
npx opensrc https://github.com/colinhacks/zod # full URL
# Fetch specific version/ref
npx opensrc zod@3.22.0
npx opensrc owner/repo@v1.0.0
| Command | Description |
|---|---|
opensrc <packages...> | Fetch source for packages/repos |
opensrc list | List all fetched sources |
opensrc remove <name> | Remove specific source |
opensrc clean | Remove all sources |
After fetching, sources stored in opensrc/ directory:
opensrc/
├── settings.json # User preferences
├── sources.json # Index of fetched packages/repos
└── repos/
└── github.com/
└── owner/
└── repo/ # Cloned source code
On first run, opensrc prompts to modify:
.gitignore - adds opensrc/ to ignore listtsconfig.json - excludes opensrc/ from compilationAGENTS.md - adds section pointing agents to source codeUse --modify or --modify=false to skip prompt.
node_modules, package-lock.json, pnpm-lock.yaml, or yarn.lockrepository.directory field--depth 1 for efficient cloning, removes .git after clonev{version}, {version}, then default branch if tag not found# Agent needs to understand zod's implementation
npx opensrc zod
# → Detects version from lockfile
# → Finds repo URL from npm registry
# → Clones at matching git tag
# → Source available at opensrc/repos/github.com/colinhacks/zod/
# Re-run same command to update to currently installed version
npx opensrc zod
# → Checks if version changed
# → Re-clones if needed
# Fetch multiple at once
npx opensrc react react-dom next
npx opensrc zod pypi:pydantic vercel/ai
For detailed information:
Weekly Installs
78
Repository
GitHub Stars
3
First Seen
Jan 25, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykWarn
Installed on
codex78
gemini-cli77
opencode77
kimi-cli76
github-copilot76
amp76
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
120,000 周安装
AVFoundation 相机问题诊断指南:解决 iOS 相机预览冻结、旋转错误、捕获缓慢
164 周安装
Sentry 错误追踪指南:Node.js/Python 异常监控、性能分析与最佳实践
162 周安装
iOS TestFlight崩溃调查指南:使用Xcode Organizer快速定位与修复Beta测试问题
162 周安装
iOS小组件与扩展开发指南:解决数据更新、实时活动与控制中心问题
161 周安装
会话管理最佳实践:JWT令牌、CSRF防护、Redis存储与安全实现指南
161 周安装
AI智能体上下文管理技能context-surfing:防止漂移与幻觉,实现高保真执行
168 周安装