This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
DeployHQ Ruby API library and CLI client. Provides programmatic access to the DeployHQ deployment platform and a command-line tool for triggering deployments.
bundle install# Run all checks (linting + tests)
bundle exec rake
# Run only linting
bundle exec rubocop
# Run only tests
bundle exec rspec
# Run a specific test file
bundle exec rspec spec/configuration_spec.rb
# Run tests with verbose output
bundle exec rspec --format documentationgem build deployhq.gemspecruby -Ilib bin/deployhq <command>Deploy Module (lib/deploy.rb): Main entry point that provides configuration management via Deploy.configure and Deploy.configuration. Configuration can be loaded from files using Deploy.configuration_file=.
Resource System: Base class pattern where Deploy::Resource provides ActiveRecord-like interface for API objects:
find(:all)andfind(id)for retrievalsave,create,updatefor persistencedestroyfor deletion- Child resources (Project, Deployment, Server, ServerGroup, DeploymentStep, DeploymentStepLog) inherit this behavior
Request Layer (lib/deploy/request.rb): HTTP client using Net::HTTP with basic auth. Handles JSON serialization/deserialization and translates HTTP status codes to appropriate exceptions or boolean success states.
CLI (lib/deploy/cli.rb): OptionParser-based command-line interface with three main commands:
configure: Interactive setup wizard for creating Deployfileservers: Lists servers and server groupsdeploy: Interactive deployment workflow with real-time progress via WebSocket
Configuration (lib/deploy/configuration.rb): Loads from JSON Deployfile containing:
account: DeployHQ account URL (e.g., https://account.deployhq.com)username: User email or usernameapi_key: API key from user profileproject: Default project permalinkwebsocket_hostname: Optional WebSocket endpoint (defaults to wss://websocket.deployhq.com)
Projects contain Servers and ServerGroups. Deployments belong to Projects and have DeploymentSteps. DeploymentSteps have DeploymentStepLogs. All child resources use the :project param to construct proper API paths like projects/:permalink/deployments/:id.
Deploy::CLI::WebSocketClient connects to deployment progress streams. Deploy::CLI::DeploymentProgressOutput consumes WebSocket messages and renders deployment progress to terminal in real-time.
This project uses Conventional Commits for automated releases via release-please.
Commit Message Format:
feat:orfeature:- New featuresfix:- Bug fixesdocs:- Documentation changesrefactor:- Code refactoringperf:- Performance improvementschore:- Maintenance tasks
On merge to master, release-please analyzes commits and creates a release PR. When merged, it:
- Updates CHANGELOG.md
- Bumps version in lib/deploy/version.rb
- Creates GitHub release
- Publishes gem to RubyGems
Each developer needs a Deployfile in their working directory (not committed). Use deployhq configure to generate interactively, or create manually following Deployfile.example.