Skip to content

Commit b63089a

Browse files
committed
fix(plugin): show created directory in new hint
1 parent 7954d02 commit b63089a

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

src/cortex-cli/src/agent_cmd/tests.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
#[cfg(test)]
44
mod tests {
55
use crate::agent_cmd::cli::{CopyArgs, ExportArgs};
6-
use crate::agent_cmd::loader::{
7-
load_builtin_agents, parse_frontmatter, read_file_with_encoding,
8-
};
6+
use crate::agent_cmd::loader::{load_builtin_agents, parse_frontmatter};
97
use crate::agent_cmd::types::AgentMode;
8+
use crate::utils::file::read_file_with_encoding;
109

1110
#[test]
1211
fn test_read_file_with_utf8() {

src/cortex-cli/src/plugin_cmd.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1363,7 +1363,7 @@ async fn run_new(args: PluginNewArgs) -> Result<()> {
13631363

13641364
println!("\nPlugin created successfully!");
13651365
println!("\nNext steps:");
1366-
println!(" cd {}", args.name);
1366+
println!(" cd {}", plugin_new_cd_target(&plugin_dir));
13671367
if args.typescript {
13681368
println!(" npm install");
13691369
println!(" npm run build");
@@ -1376,6 +1376,10 @@ async fn run_new(args: PluginNewArgs) -> Result<()> {
13761376
Ok(())
13771377
}
13781378

1379+
fn plugin_new_cd_target(plugin_dir: &Path) -> String {
1380+
plugin_dir.display().to_string()
1381+
}
1382+
13791383
// =============================================================================
13801384
// Dev Command Implementation
13811385
// =============================================================================
@@ -2966,6 +2970,17 @@ mod tests {
29662970
);
29672971
}
29682972

2973+
#[test]
2974+
fn test_plugin_new_cd_target_uses_created_directory() {
2975+
let plugin_dir = PathBuf::from("custom-output").join("output-plugin");
2976+
2977+
assert_eq!(
2978+
plugin_new_cd_target(&plugin_dir),
2979+
plugin_dir.display().to_string(),
2980+
"cd target should match the created plugin directory"
2981+
);
2982+
}
2983+
29692984
#[test]
29702985
fn test_plugin_new_args_debug() {
29712986
let args = PluginNewArgs {

0 commit comments

Comments
 (0)