Skip to content

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:

r2r eac build src-auth --rebuild #named module
r2r eac build --rebuild #all

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

# Check module contracts
r2r eac show modules

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:

# All commands
r2r eac show help

# Filtered by category
r2r eac show help | grep "show"

Help Flag

Available on all commands:

# Using --help flag
r2r eac build --help
r2r eac test suite --help

# Short form
r2r eac build -h

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:

# r2r discovers eac via extension-meta
r2r eac show modules

# Without r2r
eac show modules

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

  1. Build incrementally during development
r2r eac build src-auth  # Not --all
  1. Clean builds for releases
r2r eac build --all --clean
  1. Validate after building
r2r eac build r2r-cli && r2r eac validate artifacts r2r-cli
  1. Build before testing
r2r eac build src-auth && r2r eac test src-auth

Configuration Practices

  1. Use project-specific configuration
# Create .eac/ai-config.yml in repository
# Don't commit API keys
  1. Use environment variables in CI
env:
  EAC_AI_API_KEY: ⟪ secrets.API_KEY ⟫
  1. Document required configuration
# Setup
1. Run `r2r eac init`
2. Configure API key
3. Run `r2r eac validate`

Help Practices

  1. Always check help first
r2r eac build --help
  1. Use show help for browsing
r2r eac show help | less
  1. Check examples in help output
r2r eac help create commit-message

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

See: init command reference

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

See: build command reference

help

Display help information:

# General help
r2r eac help

# Command help
r2r eac help <command>

# Subcommand help
r2r eac help <command> <subcommand>

See: help command reference

extension-meta

Output extension metadata for r2r CLI:

r2r eac extension-meta

# Used internally by r2r CLI
# Not typically called directly

See: extension-meta command reference

See Also


Tutorials | How-to Guides | Explanation | Reference

You are here: Reference — information-oriented technical descriptions of the system.