nushell-plugins/api_nu_plugin_kcl/key_diff_api_cli_kcl.md

42 lines
1.9 KiB
Markdown
Raw Permalink Normal View History

2025-09-24 14:09:04 +01:00
key differences between api_nu_plugin_kcl and nu_plugin_kcl:
api_nu_plugin_kcl vs nu_plugin_kcl
api_nu_plugin_kcl (API-based approach):
- Uses KCL Rust API directly via kcl-lang crate
- Commands: kcl-exec, kcl-run (inline code execution)
- Dependencies: kcl-lang = { git = "https://github.com/kcl-lang/lib" }
- Functionality: Direct API integration with KCL library
- Advanced features: Dependency resolution from kcl.mod, external packages support
- File execution: Can execute multiple KCL files with project management
- Status: Not tracked in plugin registry (likely experimental/development)
nu_plugin_kcl (CLI wrapper approach):
- Uses KCL CLI wrapper via system command execution
- Commands: kcl-run, kcl-format, kcl-validate
- Dependencies: Only nushell plugin dependencies (no direct KCL API)
- Functionality: Wraps KCL CLI commands through subprocess execution
- Mature features: Full CLI integration with formatting and validation
- File operations: Single file execution with comprehensive CLI options
- Status: Tracked in plugin registry, has upstream repository
Key Architectural Differences:
1. Integration Method:
- api_nu_plugin_kcl: Direct Rust API integration
- nu_plugin_kcl: CLI subprocess wrapper
2. Capabilities:
- api_nu_plugin_kcl: Project-aware, dependency management, inline code execution
- nu_plugin_kcl: Complete CLI feature set (run/format/validate)
3. Dependencies:
- api_nu_plugin_kcl: Requires KCL Rust library compilation
- nu_plugin_kcl: Requires KCL CLI installed on system
4. Maturity:
- api_nu_plugin_kcl: Experimental, more complex but potentially more powerful
- nu_plugin_kcl: Production-ready with comprehensive documentation
The @ prefix likely indicates that api_nu_plugin_kcl is a variant or experimental version focusing on direct API integration rather
than CLI wrapping.