Repository navigation
feat(plugins): install multiple independent plugins in one command #2796
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
2 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
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.
Script executed:
Repository: Mesh-LLM/mesh-llm
Length of output: 9087
Script executed:
Repository: Mesh-LLM/mesh-llm
Length of output: 22517
Script executed:
Repository: Mesh-LLM/mesh-llm
Length of output: 24435
Script executed:
Repository: Mesh-LLM/mesh-llm
Length of output: 29706
Do not add raw credential-bearing references to the error chain.
A URL such as
https://user:token@github.com/owner/repois rejected before installation, but its parse error already includes the raw URL. The new context adds the same credential-bearing URL again, andmesh-llmrenders the full anyhow chain with{error:#}. Redact both the outer context reference and the parser error input while preserving the repository identity.