feat: 汎用プラグインBox生成システム実装とnyash.toml v2対応準備
- GenericPluginBoxを実装し、任意のプラグインBoxを動的に生成可能に - FileBox決め打ちコードを削除(設計思想違反の解消) - CURRENT_TASK.mdを更新し、nyash.toml v2対応の必要性を明確化 - 問題: プラグインテスターとNyash本体が古い単一Box型形式のまま 次のステップ: 1. nyash.tomlをv2形式(マルチBox型)に更新 2. プラグインテスターをv2対応に 3. Nyash本体のレジストリをv2対応に 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
57
src/bin/test_plugin_loader_v2.rs
Normal file
57
src/bin/test_plugin_loader_v2.rs
Normal file
@ -0,0 +1,57 @@
|
||||
//! Test program for multi-box plugin loader
|
||||
|
||||
use nyash_rust::config::NyashConfigV2;
|
||||
use nyash_rust::runtime::get_global_loader;
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
|
||||
println!("=== Multi-Box Plugin Loader Test ===\n");
|
||||
|
||||
// Load configuration
|
||||
let config_path = "test_nyash_v2.toml";
|
||||
println!("Loading configuration from: {}", config_path);
|
||||
|
||||
let config = match NyashConfigV2::from_file(config_path) {
|
||||
Ok(cfg) => cfg,
|
||||
Err(e) => {
|
||||
eprintln!("Failed to load config: {}", e);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
println!("Configuration loaded successfully!");
|
||||
println!("Is v2 format: {}", config.is_v2_format());
|
||||
|
||||
if let Some(libs) = &config.plugins.libraries {
|
||||
println!("\nLibraries found:");
|
||||
for (name, lib) in libs {
|
||||
println!(" {} -> {}", name, lib.plugin_path);
|
||||
println!(" Provides: {:?}", lib.provides);
|
||||
}
|
||||
}
|
||||
|
||||
// Load plugins
|
||||
println!("\nLoading plugins...");
|
||||
let loader = get_global_loader();
|
||||
|
||||
match loader.load_from_config(&config) {
|
||||
Ok(_) => println!("Plugins loaded successfully!"),
|
||||
Err(e) => {
|
||||
eprintln!("Failed to load plugins: {}", e);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Test box type resolution
|
||||
println!("\nTesting box type resolution:");
|
||||
for box_type in ["TestBoxA", "TestBoxB", "UnknownBox"] {
|
||||
if let Some(lib_name) = loader.get_library_for_box(box_type) {
|
||||
println!(" {} -> library: {}", box_type, lib_name);
|
||||
} else {
|
||||
println!(" {} -> not found", box_type);
|
||||
}
|
||||
}
|
||||
|
||||
println!("\nTest completed!");
|
||||
}
|
||||
Reference in New Issue
Block a user