acton-cli-0.14.1 is not a library.
Acton CLI
Production-ready CLI for scaffolding and managing backend services built with the acton-service framework.
Features
✅ Fully Implemented:
- Interactive and non-interactive service creation
- Comprehensive command structure
- Service scaffolding with multiple features
- Template-based code generation
- Git integration
- Automatic code formatting
acton service add endpoint- Add HTTP endpoints ✨ NEWacton service add worker- Add background workers ✨ NEWacton service generate deployment- Generate K8s manifests ✨ NEW
🚧 Planned:
acton service add grpc- Add gRPC servicesacton service add middleware- Add custom middlewareacton service add version- Add API versionsacton service validate- Validate service qualityacton service generate config- Generate configurationacton service generate proto- Generate proto filesacton service dev- Development tools
Installation
Build from source:
The binary will be available at target/release/acton.
Usage
Command Structure
acton
├── service
│ ├── new <service-name> # Create new service
│ ├── add
│ │ ├── endpoint # Add HTTP endpoint
│ │ ├── grpc # Add gRPC service
│ │ ├── worker # Add background worker
│ │ ├── middleware # Add middleware
│ │ └── version # Add API version
│ ├── generate
│ │ ├── deployment # Generate deployment configs
│ │ ├── config # Generate config file
│ │ └── proto # Generate proto file
│ ├── validate # Validate service
│ └── dev
│ ├── run # Run development server
│ ├── health # Check service health
│ └── logs # View logs
└── [future top-level commands]
Creating a New Service
Interactive Mode (Beginner-Friendly)
This will prompt you for:
- Service type (HTTP/gRPC/Both)
- Database support
- Caching support
- Event streaming
- Observability features
Non-Interactive Mode (Fast)
Quick Start (Minimal)
Creates a minimal HTTP service with defaults.
Available Options
--http Enable HTTP REST API (default)
--grpc Enable gRPC service
--full Enable both HTTP and gRPC
--database <TYPE> Add database (postgres)
--cache <TYPE> Add caching (redis)
--events <TYPE> Add event streaming (nats)
--auth <TYPE> Add authentication (jwt)
--observability Enable OpenTelemetry tracing
--resilience Enable circuit breaker, retry, etc.
--rate-limit Enable rate limiting
--openapi Generate OpenAPI/Swagger
--template <NAME> Use organization template
--path <DIR> Create in specific directory
--no-git Skip git initialization
-i, --interactive Interactive mode
-y, --yes Accept all defaults
--dry-run Show what would be generated
Examples
Simple HTTP API
Full-Stack Service
HTTP + gRPC Dual Protocol
Generated Project Structure
my-service/
├── Cargo.toml # Dependencies with correct features
├── config.toml # Complete configuration
├── Dockerfile # Multi-stage build
├── .dockerignore
├── .gitignore
├── README.md # Generated documentation
├── build.rs # Proto compilation (if gRPC)
├── proto/ # Proto files (if gRPC)
└── src/
├── main.rs # Service entry point
└── handlers.rs # HTTP handlers (if HTTP)
Design Philosophy
The Acton CLI follows these principles:
- Progressive Disclosure - Simple by default, powerful when needed
- Safe by Default - Prevent mistakes through validation
- Educational - Generated code teaches framework patterns
- Production-Ready - Every service meets operational standards
- Discoverable - Self-documenting with excellent help
User Personas Supported
- Beginners - Interactive wizard, educational output
- Intermediate - Fast scaffolding with flags
- Senior Engineers - Organization templates (coming soon)
- DevOps/SRE - Deployment validation (coming soon)
Architecture
The CLI is built with:
- Command parsing:
clapwith derive macros - Interactivity:
dialoguerfor prompts - Templating:
handlebarsfor code generation - Progress:
indicatiffor progress bars - Colors:
coloredandconsolefor output
Development
Project Structure
acton-cli/
├── src/
│ ├── main.rs # Entry point
│ ├── commands/
│ │ └── service/ # Service commands
│ │ ├── new.rs # ✅ Implemented
│ │ ├── add/ # 🚧 Stubs
│ │ ├── generate/ # 🚧 Stubs
│ │ ├── validate.rs # 🚧 Stub
│ │ └── dev/ # 🚧 Stubs
│ ├── templates/ # Code generation templates
│ │ ├── service.rs # ✅ main.rs templates
│ │ ├── cargo_toml.rs # ✅ Cargo.toml generation
│ │ ├── config.rs # ✅ config.toml generation
│ │ ├── handlers.rs # ✅ Handler templates
│ │ └── deployment.rs # ✅ Dockerfile templates
│ ├── utils/ # Utilities
│ │ ├── format.rs # Name conversions
│ │ ├── git.rs # Git operations
│ │ └── cargo.rs # Cargo operations
│ └── validator/ # 🚧 Validation logic
└── Cargo.toml
Building
# Development build
# Release build
# Run directly
Testing
# Create a test service
# Verify it was created
# Clean up
Command Examples
Adding HTTP Endpoints
# Add a GET endpoint
# Add a POST endpoint with full options
# Preview what would be generated
Adding Background Workers
# Add a NATS worker
# Add a Redis Stream worker
# Preview worker generation
Generating Deployments
# Generate basic Kubernetes manifests
# Generate with autoscaling and monitoring
# Generate complete production setup
# Preview deployment manifests
Next Steps
To continue implementation:
- Add gRPC Command - gRPC service generation
- Add Middleware Command - Custom middleware handlers
- Add Version Command - API versioning support
- Validate Command - Quality checks and scoring
- Generate Config Command - Configuration file generation
- Dev Commands - Development server, health checks, logs
Contributing
The CLI is designed to be extended. Key extension points:
- Templates - Add new code templates in
src/templates/ - Commands - Add new commands in
src/commands/service/ - Validators - Add validation rules in
src/validator/ - Utilities - Add helper functions in
src/utils/
License
MIT