Skip to content

feat(ls-remote): add created_at timestamps to ls-remote --json for more backends#7295

Merged
jdx merged 1 commit intomainfrom
feat/ls-remote-created-at
Dec 14, 2025
Merged

feat(ls-remote): add created_at timestamps to ls-remote --json for more backends#7295
jdx merged 1 commit intomainfrom
feat/ls-remote-created-at

Conversation

@jdx
Copy link
Copy Markdown
Owner

@jdx jdx commented Dec 14, 2025

Summary

  • Add created_at timestamps to ls-remote --json output for npm, cargo, and pipx backends
  • Add default implementation for _list_remote_versions in Backend trait that delegates to _list_remote_versions_with_info
  • Remove redundant delegation code from aqua, github, npm, pipx, and cargo backends

New backends with created_at support:

  • 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

Example output:

[{"version":"3.7.4","created_at":"2025-12-03T04:35:23.210Z"}]

Test plan

  • Added e2e tests for npm, cargo, and pipx created_at in test_ls_remote
  • Verified existing tests pass
  • Manual testing with mise 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.

  • ls-remote JSON output:
    • Add created_at metadata for:
      • npm (via npm view ... time)
      • cargo (via crates.io versions API)
      • pipx (via PyPI JSON upload_time; GitHub-hosted via release created_at)
  • Backend refactor:
    • Add default Backend::_list_remote_versions delegating to _list_remote_versions_with_info.
    • Implement _list_remote_versions_with_info in npm, cargo, and pipx to return VersionInfo { version, created_at }.
    • Remove redundant delegation in aqua and github backends.
  • Tests:
    • Extend e2e/cli/test_ls_remote to assert "created_at" in JSON for npm, cargo, and pipx.
    • Update e2e/cli/test_error_display cargo error expectation to https://crates.io/api/v1/crates/.../versions.

Written by Cursor Bugbot for commit 51075a2. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings December 14, 2025 20:26
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_versions implementation that delegates to _list_remote_versions_with_info
  • Implemented _list_remote_versions_with_info for 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.

Comment thread src/backend/mod.rs
/// 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.
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.'

Suggested change
/// WARNING: Implementing neither will cause infinite recursion.
/// WARNING: Backends must implement at least one of these methods to avoid infinite recursion.

Copilot uses AI. Check for mistakes.
Comment thread src/backend/cargo.rs
version: v.num,
created_at: Some(v.created_at),
})
.rev() // API returns newest first, we want oldest first
Copy link

Copilot AI Dec 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
.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.

Copilot uses AI. Check for mistakes.
@jdx jdx changed the title feat(cli): add created_at timestamps to ls-remote --json for more backends feat(ls-remote): add created_at timestamps to ls-remote --json for more backends Dec 14, 2025
…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>
@jdx jdx force-pushed the feat/ls-remote-created-at branch from 6cc6d83 to 51075a2 Compare December 14, 2025 20:40
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 14, 2025

Hyperfine Performance

mise x -- echo

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%

@jdx jdx enabled auto-merge (squash) December 14, 2025 20:47
@jdx jdx merged commit 5bca2ba into main Dec 14, 2025
28 checks passed
@jdx jdx deleted the feat/ls-remote-created-at branch December 14, 2025 20:50
jdx pushed a commit that referenced this pull request Dec 14, 2025
### 🚀 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants