This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- Read
../docs/PROJECT_CONTEXT.mdfirst for product/business context and the list of customer-facing invariants. - CLI changes can affect a documented public contract. Check the referenced public docs before changing commands, flags, install wording, troubleshooting guidance, or other user-visible behavior.
roc is the RunsOn CLI - a command-line tool for managing and troubleshooting RunsOn installations on AWS. It provides functionality to connect to GitHub Actions runners via AWS SSM, fetch logs, and diagnose stack health.
make build- Build the CLI binary todist/rocmake install- Build and install to/usr/local/bin/roc
make sync-metadata- Update release-facing version references inREADME.mdandaction.yml- CLI tags, binaries, and GitHub releases are published from the monorepo root via
releasectl release final
main.go- Initializes AWS config with retry logic and launches the CLI
The CLI uses the Cobra framework with commands organized under internal/cli/:
root.go- Root command setup and AWS stack configuration retrievalconnect.go- SSM connection to GitHub Actions runner instanceslogs.go- Log fetching from CloudWatch (server and instance logs)lint.go- Configuration file validation and linting (runs-on.yml)doctor.go- Stack health diagnostics and troubleshootingstack.go- Parent command for stack management operationsinterrupt.go- Trigger spot instance interruptions for testingcleanup.go- Delete the caches and sticky-disk snapshots for a job's ref
The CLI heavily integrates with AWS services:
- CloudFormation - Stack management and output retrieval
- SSM - Instance connections
- CloudWatch Logs - Log streaming
- ECS - Service health checks
- S3 - Configuration storage
- Stack name via
--stackflag orRUNS_ON_STACK_NAMEorRUNS_ON_STACKenvironment variable (default: "runs-on") - AWS credentials via standard AWS SDK configuration (profiles, environment variables, IAM roles)
- Commands retrieve stack outputs from CloudFormation to get resource ARNs
- Context propagation for AWS config through command execution
- Structured error handling with context-aware messages
- Real-time log streaming with optional watch mode
- Health check aggregation for diagnostic reports
- Configuration validation uses external
github.com/runs-on/configmodule with CUE schema - Lint command supports recursive file search, stdin input, and multiple output formats (text, json, sarif)
- Go version: see
go.mod - AWS SDK v2 for all AWS service interactions
- Cobra for CLI framework
- Google go-github for GitHub API integration
github.com/runs-on/config- Configuration schema validation (CUE-based)
- Always update the README.md when making changes to command flags, functionality, or usage patterns. The README serves as the primary user documentation and should stay in sync with the actual implementation.