Repository navigation
feat(plugins): install one or more plugins by repo name #2810
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
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
mesh/crates/mesh-llm-cli/src/parser/plugin_install_tests.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn plugins_install_accepts_local_archive_options() { | ||
| let cli = Cli::parse_from([ | ||
| "mesh-llm", | ||
| "plugins", | ||
| "install", | ||
| "--archive", | ||
| "/tmp/demo.tar.gz", | ||
| "--name", | ||
| "demo", | ||
| "--version", | ||
| "0.1.0", | ||
| ]); | ||
|
|
||
| match cli.command.expect("plugins command") { | ||
| Command::Plugin { | ||
| command: | ||
| PluginCommand::Install { | ||
| reference, | ||
| archive: Some(archive), | ||
| name: Some(name), | ||
| version: Some(version), | ||
| }, | ||
| } => { | ||
| assert!(reference.is_empty()); | ||
| assert_eq!(archive, PathBuf::from("/tmp/demo.tar.gz")); | ||
| assert_eq!(name, "demo"); | ||
| assert_eq!(version, "0.1.0"); | ||
| } | ||
| other => panic!("unexpected command: {other:?}"), | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn plugins_install_rejects_reference_with_local_archive() { | ||
| let error = Cli::try_parse_from([ | ||
| "mesh-llm", | ||
| "plugins", | ||
| "install", | ||
| "demo", | ||
| "--archive", | ||
| "/tmp/demo.tar.gz", | ||
| "--name", | ||
| "demo", | ||
| ]) | ||
| .expect_err("reference and local archive must conflict"); | ||
|
|
||
| assert!(error.to_string().contains("cannot be used with")); | ||
| } | ||
|
|
||
| #[test] | ||
| fn accepts_one_or_multiple_references_in_order() { | ||
| for references in [ | ||
| vec!["blackboard"], | ||
| vec![ | ||
| "blackboard", | ||
| "Mesh-LLM/metrics-plugin", | ||
| "https://github.com/Mesh-LLM/agents-plugin", | ||
| ], | ||
| ] { | ||
| let args = [vec!["mesh-llm", "plugins", "install"], references.clone()].concat(); | ||
| let cli = Cli::try_parse_from(args).expect("plugin references"); | ||
| let Some(Command::Plugin { | ||
| command: | ||
| PluginCommand::Install { | ||
| reference, | ||
| archive: None, | ||
| name: None, | ||
| version: None, | ||
| }, | ||
| }) = cli.command | ||
| else { | ||
| panic!("expected reference install"); | ||
| }; | ||
| assert_eq!(reference, references); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn rejects_missing_references_and_invalid_archive_options() { | ||
| for options in [ | ||
| vec![], | ||
| vec!["--archive", "demo.tar.gz"], | ||
| vec!["demo", "--name", "demo"], | ||
| vec!["demo", "--version", "1.0.0"], | ||
| vec![ | ||
| "first", | ||
| "second", | ||
| "--archive", | ||
| "demo.tar.gz", | ||
| "--name", | ||
| "demo", | ||
| ], | ||
| ] { | ||
| let args = [vec!["mesh-llm", "plugins", "install"], options].concat(); | ||
| assert!(Cli::try_parse_from(&args).is_err(), "accepted {args:?}"); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Preserve installs for plugins whose names end in
-plugin.The documented
mesh-llm/cool-pluginexample publishescool-plugin-v1.1.0-<target>assets. This change searches forcool-v1.1.0-<target>instead, so those existing packages no longer install by GitHub reference. Select the effective name from the available assets, with a fallback to the full repository name, and use that name for extraction too. (raw.githubusercontent.com)Prevent derived names from replacing another plugin.
If
foois installed, installing a different repository namedfoo-pluginnow also targetsfoo.install_pluginpasses no current metadata, and extraction replaces the existing directory; the new metadata is enabled by default. Reject a different-source collision before replacement, or require an explicit replacement action. (raw.githubusercontent.com)