1.3 KiB
1.3 KiB
ADR-001: Modular CLI Architecture
Decision: Implement modular CLI architecture for 80% code reduction.
Context
The provisioning CLI needed to support 111+ commands across multiple domains (compute, networking, storage, databases, monitoring) while maintaining code clarity and reducing maintenance burden.
Decision
Implement a command module system where:
- Each domain (compute, network, etc.) defines commands in isolation
- Commands auto-register with core CLI
- Shortcuts reduce 80% of command length
- Type-safe argument handling via Nickel schemas
Implementation
Commands structured as:
provisioning/core/commands/
├── compute/
│ ├── create-server.nu
│ ├── delete-server.nu
│ └── list-servers.nu
├── network/
│ ├── create-vpc.nu
│ └── manage-firewall.nu
└── database/
├── create-db.nu
└── backup-db.nu
Benefits
- Code Reuse: 80% reduction in duplicated code
- Maintainability: Each command self-contained
- Extensibility: New domains plug in easily
- Performance: Shortcuts reduce typing
Tradeoffs
- Slightly more indirection in command dispatch
- Learning curve for extension developers
Related ADRs
- ADR-010: Configuration Strategy
- ADR-011: Nickel Migration
Status
✅ Accepted - Implemented in v3.2.0+