This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
cLive is a Go CLI tool that automates terminal operations and displays them live in a web browser. It's designed for creating terminal demos, tutorials, and automated workflows using YAML configuration files.
go run .- Run the application directly from sourcego build- Build the binarygo test ./... -race -coverprofile=coverage.out -covermode=atomic- Run tests (CI command)go test ./internal/config -v- Run specific package tests with verbose output
go test ./internal/config- Test configuration packagego test ./internal/ttyd- Test ttyd integrationgo test ./cmd- Test CLI commands
golangci-lint run --verbose ./...- Run linter (exact CI command)mise install- Install development tools (Go 1.24.3, golangci-lint 2.1.6)
./clive init- Initialize a new clive.yml config file./clive start- Start a cLive session./clive validate- Validate configuration file./clive completion <shell>- Generate shell completions
-
cmd/: CLI commands built with Cobra frameworkinit.go- Creates default configurationstart.go- Main TUI application using Bubble Teavalidate.go- Config validationnotify.go- Notifications (likely for completion)
-
internal/config/: Configuration system with YAML parsing and JSON schema validation- Supports 6 action types: TypeAction, KeyAction, SleepAction, PauseAction, CtrlAction, ScreenshotAction
- Settings for terminal appearance, browser options, and behavior
-
internal/ui/: Bubble Tea TUI framework integration- Manages application state and user interactions during playback
-
internal/ttyd/: Integration with external ttyd process- Provides web-based terminal interface that displays in browser
-
internal/browser/: Browser automation using go-rod- Launches and controls browser to display the web terminal
-
internal/util/: Common utilities for strings, slices, integers, versions
- Cobra: CLI framework
- Bubble Tea: TUI framework for the interactive interface
- go-rod: Browser automation
- ttyd: External dependency for web terminal (version 1.7.4+)
- Prerequisites: Ensure ttyd (1.7.4+) is installed via
brew install ttyd - Tool Management: Uses mise for Go and tool versioning
mise install- Install Go 1.24.3, golangci-lint 2.1.6, goreleaser 2.9.0- Tool versions specified in
mise.toml
- Testing: Uses testify framework with table-driven tests and custom mocks
- Schema Validation:
schema.jsonprovides IDE autocompletion forclive.ymlfiles - CI/CD: GitHub Actions with 10-minute timeouts, codecov integration, release-please automation
The application uses clive.yml files with two main sections:
- settings: Terminal appearance, browser options, timing defaults
- actions: Sequence of terminal actions to execute (type, key, ctrl, sleep, pause, screenshot)
JSON schema validation ensures configuration correctness and provides IDE autocompletion.
- Uses testify framework for assertions and mocking
- Custom mocks in
internal/net/mocks_test.gofor network components - Table-driven test patterns (see
util/int_test.go) TestMainfunctions for setup/teardown in test suites- Race detection enabled in CI pipeline
- Configuration parsing has comprehensive test coverage including edge cases
Uses goreleaser for cross-platform binary distribution with multiple installation methods (Homebrew, go install, direct download).