If you’ve fetched many packages/repos over time, you currently have to re-run opensrc <pkg> or opensrc <owner/repo> for each one. opensrc update refreshes everything in one command while keeping pinned repo refs stable.
Concept
- Add
opensrc updateto refresh all previously fetched sources listed inopensrc/sources.json, matching the existing CLI style (list, remove, clean). - Preserve repo refs when updating, including refs encoded as URL hashes.
Expected usage
# Update everything already fetched
opensrc update
# Update only repos or specific registries
opensrc update --repos
opensrc update --pypi
opensrc update --cratesBehavior
- Packages: re-run with registry + name (resolves to installed/latest versions, same as re-running
opensrc <package>). - Repos: re-run with stored ref (branch/tag/commit) to avoid drifting.
Methodology
- New update command builds specs from
sources.jsonand reusesfetchCommandfor consistent logging/permissions. - Repo parser now reads URL hash refs (
https://host/owner/repo#ref) to preserve stored refs.
Coverage
- Added unit tests for update spec building and URL hash ref parsing.
- Ran
npm test,npm run type-check, andnpm run format:check.
Activity
10Thanks for adding the update command - the core functionality looks good and the tests are solid
Before merging, please scope down the isRepoSpec change. Treating any HTTPS URL with 2+ path segments as a repo is too broad and will cause false positives (e.g., https://cdn.example.com/assets/bundle would be misclassified)
thanks. happy to adjust
I run this via my justfile:
cat opensrc/sources.json | jq -r '.repos[].name' | sed 's|github.com/||' | xargs opensrc
@aavetis Hey! Just a heads up — the CLI was rewritten in Rust (v0.7.0), so this PR can't be merged as-is against the old Node.js codebase. The update command is still a great feature though.
Feel free to re-submit against the Rust CLI (packages/opensrc/cli/), or I'm happy to implement it myself. Let me know!
@aavetis is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.