feat(ls-remote): add created_at timestamps to ls-remote --json for more backends#7295
feat(ls-remote): add created_at timestamps to ls-remote --json for more backends#7295
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances the ls-remote --json command by adding created_at timestamp support for npm, cargo, and pipx backends. The changes introduce a default implementation in the Backend trait that allows backends to delegate version listing to the metadata-aware method, reducing code duplication.
Key changes:
- Added default
_list_remote_versionsimplementation that delegates to_list_remote_versions_with_info - Implemented
_list_remote_versions_with_infofor npm (using npm registry API), cargo (using crates.io API), and pipx (using PyPI JSON API) - Removed redundant delegation code from aqua and github backends
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/backend/mod.rs | Added default implementation for _list_remote_versions that delegates to _list_remote_versions_with_info |
| src/backend/npm.rs | Replaced npm CLI approach with direct registry API call to fetch versions with timestamps |
| src/backend/cargo.rs | Switched from index API to crates.io API v1 to include created_at timestamps |
| src/backend/pipx.rs | Enhanced to return VersionInfo with timestamps from PyPI's upload_time field |
| src/backend/github.rs | Removed redundant _list_remote_versions override now handled by default implementation |
| src/backend/aqua.rs | Removed redundant _list_remote_versions override now handled by default implementation |
| e2e/cli/test_ls_remote | Added e2e tests verifying created_at presence in JSON output for npm, cargo, and pipx |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /// Backend implementation for fetching remote versions (without metadata). | ||
| /// Default delegates to `_list_remote_versions_with_info`. | ||
| /// Override this OR `_list_remote_versions_with_info` (not both needed). | ||
| /// WARNING: Implementing neither will cause infinite recursion. |
There was a problem hiding this comment.
The warning about infinite recursion is misleading. If a backend implements neither method, it will cause infinite recursion, but this is not clearly stated. Consider rephrasing to: 'WARNING: Backends must implement at least one of these methods to avoid infinite recursion.'
| /// WARNING: Implementing neither will cause infinite recursion. | |
| /// WARNING: Backends must implement at least one of these methods to avoid infinite recursion. |
| version: v.num, | ||
| created_at: Some(v.created_at), | ||
| }) | ||
| .rev() // API returns newest first, we want oldest first |
There was a problem hiding this comment.
The comment states 'API returns newest first, we want oldest first', but there's no clear requirement established elsewhere in the codebase that versions should be in oldest-first order. Consider verifying this requirement is consistent with other backends or document why this ordering is necessary.
| .rev() // API returns newest first, we want oldest first | |
| .rev() // API returns newest first, we want oldest first. | |
| // Note: Other backends (e.g., <add backend names if known>) and consumers of this function expect versions in oldest-first order. | |
| // This ordering is required for consistency across backends and for correct version selection logic elsewhere in the codebase. | |
| // If this changes, update all consumers accordingly. |
…kends Add created_at timestamps to ls-remote --json output for npm, cargo, and pipx backends: - NPM: Uses npm registry API which provides publish timestamps in the `time` field - Cargo: Uses crates.io API which provides `created_at` for each version - PyPI/Pipx: Uses PyPI JSON API `upload_time` field; GitHub-hosted packages also get timestamps Also adds a default implementation for `_list_remote_versions` in the Backend trait that delegates to `_list_remote_versions_with_info`, allowing backends to implement only the timestamped version without code duplication. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
6cc6d83 to
51075a2
Compare
Hyperfine Performance
|
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 x -- echo |
21.8 ± 0.6 | 20.5 | 25.1 | 1.00 |
mise x -- echo |
22.0 ± 0.8 | 21.0 | 30.9 | 1.01 ± 0.05 |
mise env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 env |
21.2 ± 0.9 | 19.9 | 27.7 | 1.00 |
mise env |
22.0 ± 0.8 | 20.2 | 27.4 | 1.04 ± 0.06 |
mise hook-env
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 hook-env |
21.7 ± 0.6 | 20.0 | 25.2 | 1.00 |
mise hook-env |
22.1 ± 0.8 | 20.4 | 25.8 | 1.02 ± 0.05 |
mise ls
| Command | Mean [ms] | Min [ms] | Max [ms] | Relative |
|---|---|---|---|---|
mise-2025.12.6 ls |
18.2 ± 0.7 | 16.7 | 22.5 | 1.00 |
mise ls |
18.5 ± 0.6 | 17.2 | 21.0 | 1.02 ± 0.05 |
xtasks/test/perf
| Command | mise-2025.12.6 | mise | Variance |
|---|---|---|---|
| install (cached) | 112ms | 112ms | +0% |
| ls (cached) | 67ms | 67ms | +0% |
| bin-paths (cached) | 74ms | 73ms | +1% |
| task-ls (cached) | 443ms | 440ms | +0% |
### 🚀 Features - **(java)** add created_at support to ls-remote --json by @jdx in [#7297](#7297) - **(ls-remote)** add created_at timestamps to ls-remote --json for more backends by @jdx in [#7295](#7295) - **(ls-remote)** add created_at timestamps to ls-remote --json for core plugins by @jdx in [#7294](#7294) - **(registry)** add --json flag to registry command by @jdx in [#7290](#7290) - **(ruby)** add created_at timestamps to ls-remote --json by @jdx in [#7296](#7296) ### 🐛 Bug Fixes - **(spm)** recursively update submodules after checkout by @JFej in [#7292](#7292) - prioritize raw task output over task_output setting by @skorfmann in [#7286](#7286) ### New Contributors - @skorfmann made their first contribution in [#7286](#7286) - @JFej made their first contribution in [#7292](#7292)
Summary
created_attimestamps tols-remote --jsonoutput for npm, cargo, and pipx backends_list_remote_versionsin Backend trait that delegates to_list_remote_versions_with_infoNew backends with
created_atsupport:timefieldcreated_atfor each versionupload_timefield; GitHub-hosted packages also get timestampsExample output:
[{"version":"3.7.4","created_at":"2025-12-03T04:35:23.210Z"}]Test plan
created_atintest_ls_remotemise ls-remote npm:prettier --json,mise ls-remote cargo:eza --json,mise ls-remote pipx:black --json🤖 Generated with Claude Code
Note
Adds created_at to ls-remote --json for npm, cargo, and pipx, and refactors Backend to provide a default _list_remote_versions; updates e2e tests and cargo error expectations.
created_atmetadata for:npm(vianpm view ... time)cargo(viacrates.ioversions API)pipx(via PyPI JSONupload_time; GitHub-hosted via releasecreated_at)Backend::_list_remote_versionsdelegating to_list_remote_versions_with_info._list_remote_versions_with_infoinnpm,cargo, andpipxto returnVersionInfo { version, created_at }.aquaandgithubbackends.e2e/cli/test_ls_remoteto assert"created_at"in JSON fornpm,cargo, andpipx.e2e/cli/test_error_displaycargo error expectation tohttps://crates.io/api/v1/crates/.../versions.Written by Cursor Bugbot for commit 51075a2. This will update automatically on new commits. Configure here.