Skip to content

fix: deepen local PHP version store and enforce CLI-present resolution - #62

Open
Fahl-Design wants to merge 1 commit into
mainfrom
refactor/issue-51-local-version-store
Open

Fahl-Design wants to merge 1 commit into
mainfrom
refactor/issue-51-local-version-store

Conversation

@Fahl-Design

@Fahl-Design Fahl-Design commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Consolidates installed PHP version discovery, package inventory, semver minor-line grouping, and prefix resolution into a single deep 'LocalVersionStore' module in 'src/versions.rs'.

  • Semver minor-line ordering: Introduces 'MinorVersion' ('(major, minor)' numeric ordering) and 'group_by_minor', so minor lines like '8.10' sort after '8.9' rather than before '8.2' across 'ls', 'prune', 'init', and 'install'.
  • CLI-present resolution: Enforces CLI binary ('bin/php') presence for 'use', 'default', 'exec', 'which', and interactive 'ls' switching so FPM-only or micro-only sibling directories cannot hijack CLI operations, while 'uninstall' continues to resolve all installed directories via 'resolve_any'.
  • Unified grouping and prefix matching: Shares 'group_by_minor', 'matches_prefix', and 'resolve_version' across 'LocalVersionStore', 'prune', 'ls-remote', 'init', 'install', 'default', 'update', and 'network' instead of per-command maps.
  • Lean local resolution: 'resolve_cli', 'try_resolve_cli', and 'resolve_any' resolve directly from directory/binary checks without constructing 'VersionItem' UI display structs or computing package lists.
  • Tests: Adds unit tests in 'src/versions.rs' and CLI integration tests in 'tests/cli.rs' covering semver minor ordering ('8.2' vs '8.9' vs '8.10'), mixed-package ('cli' vs 'fpm'-only vs 'micro'-only) resolution, and all local resolution paths ('latest', exact, minor prefix).

Verification

  • 'cargo fmt --all -- --check'
  • 'cargo clippy -- -D warnings'
  • 'cargo test' (38 unit tests + 49 CLI integration tests passing)

Closes #51


Get evidence
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 21 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e94ed0a9-9b95-42d0-9d4a-970918ecd822
Commits

Reviewing files that changed from the base of the PR and between 817c84e and 8c24e1f.

Files selected for processing: 17

  • src/commands/default_cmd.rs
  • src/commands/env.rs
  • src/commands/exec_cmd.rs
  • src/commands/init.rs
  • src/commands/install.rs
  • src/commands/ls.rs
  • src/commands/ls_remote.rs
  • src/commands/prune.rs
  • src/commands/uninstall.rs
  • src/commands/use_cmd.rs
  • src/commands/which_cmd.rs
  • src/fs.rs
  • src/main.rs
  • src/network.rs
  • src/update.rs
  • src/versions.rs
  • tests/cli.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Consolidate installed PHP version discovery, package inventory, semver minor-line grouping, and prefix resolution into a single LocalVersionStore module in 'src/versions.rs'.

- Sort installed and remote minor lines by semver (MinorVersion) rather than lexicographically so '8.10' sorts after '8.9'.
- Enforce CLI-present resolution for 'use', 'default', 'exec', 'which', and interactive 'ls' switching so FPM-only and micro-only sibling directories cannot hijack CLI commands.
- Unify minor-line grouping, keeper selection ('prune'), and prefix matching ('ls-remote', 'init', 'install', 'default', 'network') behind shared helpers in 'src/versions.rs'.
- Resolve local versions directly without building UI VersionItem lists or computing full package inventories.
- Add unit and CLI tests covering semver minor ordering, mixed-package resolution, and all local resolution paths.

Closes #51
@Fahl-Design
Fahl-Design force-pushed the refactor/issue-51-local-version-store branch from 355f8cd to 8c24e1f Compare November 30, 2026 20:03
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.

Deepen local PHP version store and enforce CLI-present resolution

1 participant