-
Notifications
You must be signed in to change notification settings - Fork 355
feat: implement external command discovery for pixi extensions #3968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement external command discovery for pixi extensions #3968
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should serve as the foundation for handling external subcommands. The idea is that from this command::external
place we can start finding and executing commands.
Hardcoding available commands is often not a good idea because it requires keeping track of and modifying them everywhere, which is prone to errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be a good thing to have some integration tests ( in python ) that will test finding the pixi-extension and executing them correctly. You can take a look how we do it for pixi global
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small change and by fixing the CI I think we can merge it
cwd=tmp_pixi_workspace, | ||
stderr_contains="No such command: `pixi nonexistent`", | ||
expected_exit_code=ExitCode.FAILURE, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also test that it always takes the pixi commands first, e.g. pixi global install -e pixi-foobar --expose pixi-info=pixi-foobar
To make sure pixi itself always "wins"
after a discussion with @ruben-arts - we may want in followup implementation did_you_mean error message |
also would be good to have some initial documentation ( pixi facing rather than pixi extension developer) around this behaviour |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work @mrswastik-robot and @nichmor 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good from my side
Implements external command discovery infrastructure following cargo's proven pattern, enabling pixi to find and recognize
pixi-*
executables in the system PATH.Changes
src/cli/command_info.rs
with complete external command discoveryfind_external_commands()
- Discovers allpixi-*
executables in PATHfind_external_subcommand()
- Finds specific external command by namesearch_directories()
- PATH traversal following cargo's exact patternis_executable()
- Cross-platform executable detectionbuiltin_exec()
- Built-in command existence checkNext Steps
This lays the foundation for command dispatching logic, allowing us to integrate this discovery with the main CLI dispatcher.
Part of #3957
Parent issue - #3956