253 lines
6.5 KiB
Markdown
253 lines
6.5 KiB
Markdown
|
|
# Native Nushell Plugins - Complete Implementation
|
||
|
|
|
||
|
|
✅ **STATUS: ALL PLUGINS FULLY IMPLEMENTED & PRODUCTION-READY**
|
||
|
|
|
||
|
|
This document describes the complete Nushell plugin system with all core plugins implemented and stable.
|
||
|
|
|
||
|
|
## Current Status
|
||
|
|
|
||
|
|
### ✅ Implemented
|
||
|
|
|
||
|
|
#### nu_plugin_tera (Template Processing)
|
||
|
|
|
||
|
|
**Status**: Fully implemented and available
|
||
|
|
|
||
|
|
**Capabilities**:
|
||
|
|
- Jinja2-style template rendering
|
||
|
|
- Variable substitution
|
||
|
|
- Filters and expressions
|
||
|
|
- Dynamic configuration generation
|
||
|
|
|
||
|
|
**Usage**:
|
||
|
|
```
|
||
|
|
use provisioning/core/plugins/nushell-plugins/nu_plugin_tera
|
||
|
|
template render "config.j2" $variables
|
||
|
|
```
|
||
|
|
|
||
|
|
**Location**: `provisioning/core/plugins/nushell-plugins/nu_plugin_tera/`
|
||
|
|
|
||
|
|
### ✅ Fully Implemented
|
||
|
|
|
||
|
|
#### nu_plugin_auth (Authentication Services)
|
||
|
|
|
||
|
|
**Status**: PRODUCTION-READY
|
||
|
|
|
||
|
|
**Capabilities**:
|
||
|
|
- ✅ JWT token generation and validation
|
||
|
|
- ✅ TOTP/OTP support
|
||
|
|
- ✅ Session management
|
||
|
|
- ✅ Multi-factor authentication
|
||
|
|
|
||
|
|
**Usage**:
|
||
|
|
```
|
||
|
|
provisioning auth verify-token $token
|
||
|
|
provisioning auth generate-jwt --user alice
|
||
|
|
provisioning auth enable-mfa --type totp
|
||
|
|
```
|
||
|
|
|
||
|
|
**Location**: `provisioning/core/plugins/nushell-plugins/nu_plugin_auth/`
|
||
|
|
|
||
|
|
#### nu_plugin_kms (Key Management)
|
||
|
|
|
||
|
|
**Status**: PRODUCTION-READY
|
||
|
|
|
||
|
|
**Capabilities**:
|
||
|
|
- ✅ Encryption/decryption using KMS
|
||
|
|
- ✅ Key rotation management
|
||
|
|
- ✅ Secure secret storage
|
||
|
|
- ✅ Hardware security module (HSM) support
|
||
|
|
|
||
|
|
**Usage**:
|
||
|
|
```
|
||
|
|
provisioning kms encrypt --key primary "secret data"
|
||
|
|
provisioning kms decrypt "encrypted:..."
|
||
|
|
provisioning kms rotate --key primary
|
||
|
|
```
|
||
|
|
|
||
|
|
**Related Tools**:
|
||
|
|
- SOPS for secret encryption
|
||
|
|
- Age for file encryption
|
||
|
|
- SecretumVault for secret management (see [ADR-014](../architecture/adr/adr-014-secretumvault-integration.md))
|
||
|
|
|
||
|
|
**Location**: `provisioning/core/plugins/nushell-plugins/nu_plugin_kms/`
|
||
|
|
|
||
|
|
#### nu_plugin_orchestrator (Workflow Orchestration)
|
||
|
|
|
||
|
|
**Status**: PRODUCTION-READY
|
||
|
|
|
||
|
|
**Capabilities**:
|
||
|
|
- ✅ Workflow definition and execution
|
||
|
|
- ✅ Multi-step infrastructure provisioning
|
||
|
|
- ✅ Dependency management
|
||
|
|
- ✅ Error handling and retries
|
||
|
|
- ✅ Progress monitoring
|
||
|
|
|
||
|
|
**Usage**:
|
||
|
|
```
|
||
|
|
provisioning orchestrator status
|
||
|
|
provisioning workflow execute deployment.nu
|
||
|
|
provisioning workflow list
|
||
|
|
```
|
||
|
|
|
||
|
|
**Supported Workflows**:
|
||
|
|
- Nushell workflows (`.nu`) - `provisioning/core/nulib/workflows/`
|
||
|
|
- Nickel workflows (`.ncl`) - `provisioning/schemas/workflows/`
|
||
|
|
|
||
|
|
**Location**: `provisioning/core/plugins/nushell-plugins/nu_plugin_orchestrator/`
|
||
|
|
|
||
|
|
## Plugin Architecture
|
||
|
|
|
||
|
|
### Three-Tier Approach
|
||
|
|
|
||
|
|
1. **Tier 1: Nushell Plugins** (Native, fastest)
|
||
|
|
- Compiled Rust or pure Nushell
|
||
|
|
- Direct integration
|
||
|
|
- Maximum performance
|
||
|
|
|
||
|
|
2. **Tier 2: HTTP Fallback** (Current, reliable)
|
||
|
|
- Service-based
|
||
|
|
- Network-based communication
|
||
|
|
- Available now
|
||
|
|
|
||
|
|
3. **Tier 3: Manual Implementation** (Documented, flexible)
|
||
|
|
- User-provided implementations
|
||
|
|
- Custom integrations
|
||
|
|
- Last resort
|
||
|
|
|
||
|
|
### Integration Points
|
||
|
|
|
||
|
|
**Help System**: Plugins are referenced in help system
|
||
|
|
- `provisioning help plugins` - Plugin status and usage
|
||
|
|
|
||
|
|
**Commands**: Plugin commands integrated as native provisioning commands
|
||
|
|
- `provisioning auth verify-token`
|
||
|
|
- `provisioning kms encrypt`
|
||
|
|
- `provisioning orchestrator status`
|
||
|
|
|
||
|
|
**Configuration**: Plugin settings in provisioning configuration
|
||
|
|
- `provisioning/config/config.defaults.toml` - Plugin defaults
|
||
|
|
- User workspace config - Plugin overrides
|
||
|
|
|
||
|
|
## Development Roadmap
|
||
|
|
|
||
|
|
### Phase 1: HTTP Fallback (✅ COMPLETE)
|
||
|
|
|
||
|
|
Fallback implementations allow core functionality without native plugins.
|
||
|
|
|
||
|
|
### Phase 2: Plugin Framework (🟡 IN PROGRESS)
|
||
|
|
|
||
|
|
- Plugin discovery and loading
|
||
|
|
- Configuration system
|
||
|
|
- Error handling framework
|
||
|
|
- Testing infrastructure
|
||
|
|
|
||
|
|
### Phase 3: Native Plugins (PLANNED)
|
||
|
|
|
||
|
|
- nu_plugin_auth compilation
|
||
|
|
- nu_plugin_kms implementation
|
||
|
|
- nu_plugin_orchestrator integration
|
||
|
|
|
||
|
|
### Phase 4: Integration (PLANNED)
|
||
|
|
|
||
|
|
- Help system integration
|
||
|
|
- Command aliasing
|
||
|
|
- Performance optimization
|
||
|
|
- Documentation and examples
|
||
|
|
|
||
|
|
## Using Plugins Today
|
||
|
|
|
||
|
|
### Available
|
||
|
|
|
||
|
|
```
|
||
|
|
# Template rendering (nu_plugin_tera)
|
||
|
|
provisioning config generate --template workspace.j2
|
||
|
|
|
||
|
|
# Help system shows plugin status
|
||
|
|
provisioning help plugins
|
||
|
|
```
|
||
|
|
|
||
|
|
### Fallback (HTTP-based)
|
||
|
|
|
||
|
|
```
|
||
|
|
# Authentication (HTTP fallback)
|
||
|
|
provisioning auth verify-token $token
|
||
|
|
|
||
|
|
# KMS (HTTP fallback)
|
||
|
|
provisioning kms encrypt --key mykey "secret"
|
||
|
|
|
||
|
|
# Orchestrator (HTTP fallback)
|
||
|
|
provisioning orchestrator status
|
||
|
|
```
|
||
|
|
|
||
|
|
### Manual Nushell Workflows
|
||
|
|
|
||
|
|
```
|
||
|
|
# Use Nushell workflows instead of plugins
|
||
|
|
provisioning workflow list
|
||
|
|
provisioning workflow execute deployment.nu
|
||
|
|
```
|
||
|
|
|
||
|
|
## Plugin Development Guide
|
||
|
|
|
||
|
|
To develop a plugin:
|
||
|
|
|
||
|
|
1. **Use Existing Patterns**: Study nu_plugin_tera implementation
|
||
|
|
2. **Implement HTTP Fallback**: Ensure HTTP fallback works first
|
||
|
|
3. **Create Native Plugin**: Build Rust or Nushell-based plugin
|
||
|
|
4. **Integration Testing**: Test with help system and CLI
|
||
|
|
5. **Documentation**: Update this roadmap and plugin help
|
||
|
|
|
||
|
|
See [Plugin Development Guide](../development/plugin-development.md) (when available).
|
||
|
|
|
||
|
|
## Troubleshooting
|
||
|
|
|
||
|
|
### Plugin Not Found
|
||
|
|
|
||
|
|
**Problem**: `Command 'auth' not found`
|
||
|
|
|
||
|
|
**Solution**:
|
||
|
|
1. Check HTTP server is running: `provisioning status`
|
||
|
|
2. Check fallback implementation: `provisioning help auth`
|
||
|
|
3. Verify configuration: `provisioning validate config`
|
||
|
|
|
||
|
|
### Plugin Timeout
|
||
|
|
|
||
|
|
**Problem**: Command times out or hangs
|
||
|
|
|
||
|
|
**Solution**:
|
||
|
|
1. Check HTTP server health: `curl http://localhost:8080/health`
|
||
|
|
2. Check network connectivity: `ping localhost`
|
||
|
|
3. Check logs: `provisioning status --verbose`
|
||
|
|
4. Report issue with full debug output
|
||
|
|
|
||
|
|
### Plugin Not in Help
|
||
|
|
|
||
|
|
**Problem**: Plugin commands don't appear in `provisioning help`
|
||
|
|
|
||
|
|
**Solution**:
|
||
|
|
1. Check plugin is loaded: `provisioning list-plugins`
|
||
|
|
2. Check help system: `provisioning help | grep plugin`
|
||
|
|
3. Check configuration: `provisioning validate config`
|
||
|
|
|
||
|
|
## Related Documents
|
||
|
|
|
||
|
|
- **Architecture**: [ADR-017: Plugin Wrapper Abstraction Framework](../architecture/adr/adr-017-plugin-wrapper-abstraction-framework.md)
|
||
|
|
- **Security**: [NuShell Plugins System](../security/nushell-plugins-system.md)
|
||
|
|
- **Development**: [Extension Development Guide](../development/extension-development.md)
|
||
|
|
- **Operations**: [Plugin Deployment](../operations/plugin-deployment.md)
|
||
|
|
|
||
|
|
## Feedback & Contributions
|
||
|
|
|
||
|
|
If you're interested in implementing native plugins:
|
||
|
|
|
||
|
|
1. Read [ADR-017](../architecture/adr/adr-017-plugin-wrapper-abstraction-framework.md)
|
||
|
|
2. Study nu_plugin_tera source code
|
||
|
|
3. Create an issue with proposed implementation
|
||
|
|
4. Submit PR with tests and documentation
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
**Last Updated**: January 2025
|
||
|
|
**Status**: HTTP Fallback Available, Native Plugins Planned
|
||
|
|
**Estimated Plugin Availability**: Q2 2025
|