Other Commands
Overview
Other commands provide essential functionality that doesn't fit neatly into other categories. This includes project initialization, build execution, help documentation, and extension metadata.
Key Characteristics:
- Essential project operations
- Configuration and setup
- Build execution
- Documentation access
- Extension integration
When to use: For project setup, building artifacts, accessing help, and extension integration.
All Other Commands
| Command | Purpose | Use Case |
|---|---|---|
| init | Initialize AI provider configuration | Set up API keys and AI provider settings |
| build | Build modules | Compile and package modules |
| help | Display help information | Get command documentation |
| show help | Show help in formatted output | Interactive help browsing |
| extension-meta | Output extension metadata | r2r CLI integration |
Build Commands
Overview
The build command compiles and packages modules respecting dependency order. It's a fundamental command for producing deployable artifacts.
When to use:
- During development to compile code changes
- In CI/CD pipelines for artifact creation
- Before testing to ensure latest code is compiled
- Before deployment to produce release artifacts
Basic Build Usage
# Build single module
r2r eac build src-auth
# Build multiple modules
r2r eac build src-auth src-api
# Build all modules
r2r eac build --all
# Build with dependencies
r2r eac build r2r-cli
# Automatically builds all dependencies first
Build Order
Builds respect dependency order automatically:
# If r2r-cli depends on eac-commands which depends on eac-core
r2r eac build r2r-cli
# Builds in order:
# 1. eac-core (no dependencies)
# 2. eac-commands (depends on eac-core)
# 3. r2r-cli (depends on eac-commands)
Incremental Builds
Build only changed modules:
# Get changed modules
CHANGED=$(r2r eac get changed-modules | jq -r '.changed_modules[]')
# Build only what changed
r2r eac build $CHANGED
Clean Builds
Force rebuild from scratch:
Build Output
Artifacts are placed in configured output directories:
bin/
├── eac # eac-commands binary
├── r2r # r2r-cli binary
└── lib/
├── auth.a # src-auth library
└── api.a # src-api library
Build Performance
# Show build times
r2r eac show build-times
# Find slow builds
r2r eac get build-times | jq '[.builds[]] | sort_by(.duration) | reverse'
# Parallel builds (if supported)
r2r eac build --parallel
Build in CI/CD
# Build changed modules in CI
r2r eac get changed-modules-ci | jq -r '.changed_modules[]' | while read module; do
r2r eac build $module
done
# Validate artifacts exist
r2r eac validate artifacts r2r-cli
Build Integration
# Build and test
r2r eac build src-auth && r2r eac test src-auth
# Build and run
r2r eac build r2r-cli && ./out/build/r2r-cli/r2r-linux-amd64 --version
Common Build Issues
Initialization Commands
init Command
Configure AI provider for EAC commands:
# Interactive configuration
r2r eac init
# Prompts for:
# - AI provider (Anthropic, OpenAI, Google, etc.)
# - API key
# - Model selection
# - Configuration file location
Configuration file locations:
.r2r/*.yml- Repository-specific r2r configurations.r2r/eac/*.yml- Repository-specific eac configurations.r2r/eac/*.personal.yml- User-specific overries
When to Run init
First time setup:
# Clone repository
git clone https://github.com/your-org/project
cd project
# Initialize R2R
r2r init
# Initialize EAC
r2r eac init
Switching providers:
# Reconfigure for different provider
r2r eac init --ai-provider
# Override with environment variable
export EAC_AI_PROVIDER=openai
export EAC_AI_API_KEY=sk-...
Help Commands
help Command
Display command help information:
# General help
r2r eac help
# Command-specific help
r2r eac help build
r2r eac help test suite
# Category help
r2r eac help show
show help Command
Display help in formatted table:
Help Flag
Available on all commands:
Extension Metadata
extension-meta Command
Output metadata for r2r CLI integration:
# Get extension metadata
r2r eac extension-meta
# Output:
# {
# "name": "eac",
# "version": "1.0.0",
# "commands": [...],
# "description": "Engineering Automation Commands"
# }
Purpose: Enables the r2r CLI to discover and integrate EAC commands as an extension.
Usage in r2r:
Common Workflows
New Project Setup
# 1. Clone repository
git clone https://github.com/your-org/project
cd project
# 2. Initialize AI provider
r2r eac init
# 3. Validate repository
r2r eac validate
# 4. Build all modules
r2r eac build --all
# 5. Run tests
r2r eac test
Development Cycle
# 1. Make code changes
# ... edit files ...
# 2. Build changed modules
r2r eac build src-auth
# 3. Run tests
r2r eac test src-auth
# 4. Commit
r2r eac work commit --all
CI/CD Pipeline
# 1. Validate repository structure
r2r eac validate
# 2. Build changed modules
CHANGED=$(r2r eac get changed-modules-ci | jq -r '.changed_modules[]')
for module in $CHANGED; do
r2r eac build $module
done
# 3. Run tests
r2r eac test $CHANGED
# 4. Validate artifacts
for module in $CHANGED; do
r2r eac validate artifacts $module
done
# 5. Deploy if successful
# ... deployment steps ...
Configuration
Build Configuration
Configure build behavior in module contracts:
# .eac/contracts/modules/src-auth.yml
moniker: src-auth
type: go-library
path: go/src/auth
build:
output: bin/lib/auth.a
flags: ["-ldflags", "-s -w"]
env:
CGO_ENABLED: "0"
AI Configuration
Configure AI provider:
# .eac/ai-config.yml
provider: anthropic
api_key: ${ANTHROPIC_API_KEY}
model: claude-3-5-sonnet-20241022
max_tokens: 4096
temperature: 0.7
Environment Variables
# AI Configuration
export EAC_AI_PROVIDER=anthropic
export EAC_AI_API_KEY=sk-ant-...
export EAC_AI_MODEL=claude-3-5-sonnet-20241022
# Build Configuration
export EAC_BUILD_PARALLEL=true
export EAC_BUILD_CLEAN=false
# General Configuration
export EAC_DEBUG=true
export EAC_VERBOSE=true
Best Practices
Build Practices
- Build incrementally during development
- Clean builds for releases
- Validate after building
- Build before testing
Configuration Practices
- Use project-specific configuration
- Use environment variables in CI
- Document required configuration
Help Practices
- Always check help first
- Use show help for browsing
- Check examples in help output
Command Details
init
Initialize AI provider configuration:
# Interactive setup
r2r eac init
# Non-interactive (CI)
r2r eac init --non-interactive \
--provider anthropic \
--api-key $ANTHROPIC_API_KEY
build
Build one or more modules:
# Single module
r2r eac build src-auth
# Multiple modules
r2r eac build src-auth src-api
# All modules
r2r eac build --all
# With options
r2r eac build src-auth --clean --verbose
help
Display help information:
# General help
r2r eac help
# Command help
r2r eac help <command>
# Subcommand help
r2r eac help <command> <subcommand>
extension-meta
Output extension metadata for r2r CLI:
See: extension-meta command reference
See Also
- validate - Validate repository structure
- show modules - List all modules
- test - Run tests
- work - Workspace management
- get modules - Module metadata
- Configuration Guide
Tutorials | How-to Guides | Explanation | Reference
You are here: Reference — information-oriented technical descriptions of the system.