provisioning/docs/src/architecture/adr/adr-001-modular-cli.md

58 lines
1.3 KiB
Markdown
Raw Normal View History

2026-01-17 03:58:28 +00:00
# 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:
1. Each domain (compute, network, etc.) defines commands in isolation
2. Commands auto-register with core CLI
3. Shortcuts reduce 80% of command length
4. Type-safe argument handling via Nickel schemas
## Implementation
Commands structured as:
```text
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+