Skip to content

Commit 125521c

Browse files
committed
chore: Create CLAUDE.md
1 parent 0bba12a commit 125521c

File tree

1 file changed

+91
-0
lines changed

1 file changed

+91
-0
lines changed

CLAUDE.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Project Overview
6+
7+
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.
8+
9+
## Essential Commands
10+
11+
### Development
12+
- `go run .` - Run the application directly from source
13+
- `go build` - Build the binary
14+
- `go test ./... -race -coverprofile=coverage.out -covermode=atomic` - Run tests (CI command)
15+
- `go test ./internal/config -v` - Run specific package tests with verbose output
16+
17+
### Testing Specific Packages
18+
- `go test ./internal/config` - Test configuration package
19+
- `go test ./internal/ttyd` - Test ttyd integration
20+
- `go test ./cmd` - Test CLI commands
21+
22+
### Linting and Quality
23+
- `golangci-lint run --verbose ./...` - Run linter (exact CI command)
24+
- `mise install` - Install development tools (Go 1.24.3, golangci-lint 2.1.6)
25+
26+
### Application Usage
27+
- `./clive init` - Initialize a new clive.yml config file
28+
- `./clive start` - Start a cLive session
29+
- `./clive validate` - Validate configuration file
30+
- `./clive completion <shell>` - Generate shell completions
31+
32+
## Architecture
33+
34+
### Core Components
35+
- **`cmd/`**: CLI commands built with Cobra framework
36+
- `init.go` - Creates default configuration
37+
- `start.go` - Main TUI application using Bubble Tea
38+
- `validate.go` - Config validation
39+
- `notify.go` - Notifications (likely for completion)
40+
41+
- **`internal/config/`**: Configuration system with YAML parsing and JSON schema validation
42+
- Supports 6 action types: TypeAction, KeyAction, SleepAction, PauseAction, CtrlAction, ScreenshotAction
43+
- Settings for terminal appearance, browser options, and behavior
44+
45+
- **`internal/ui/`**: Bubble Tea TUI framework integration
46+
- Manages application state and user interactions during playback
47+
48+
- **`internal/ttyd/`**: Integration with external ttyd process
49+
- Provides web-based terminal interface that displays in browser
50+
51+
- **`internal/browser/`**: Browser automation using go-rod
52+
- Launches and controls browser to display the web terminal
53+
54+
- **`internal/util/`**: Common utilities for strings, slices, integers, versions
55+
56+
### Key Dependencies
57+
- **Cobra**: CLI framework
58+
- **Bubble Tea**: TUI framework for the interactive interface
59+
- **go-rod**: Browser automation
60+
- **ttyd**: External dependency for web terminal (version 1.7.4+)
61+
62+
## Development Workflow
63+
64+
1. **Prerequisites**: Ensure ttyd (1.7.4+) is installed via `brew install ttyd`
65+
2. **Tool Management**: Uses mise for Go and tool versioning
66+
- `mise install` - Install Go 1.24.3, golangci-lint 2.1.6, goreleaser 2.9.0
67+
- Tool versions specified in `mise.toml`
68+
3. **Testing**: Uses testify framework with table-driven tests and custom mocks
69+
4. **Schema Validation**: `schema.json` provides IDE autocompletion for `clive.yml` files
70+
5. **CI/CD**: GitHub Actions with 10-minute timeouts, codecov integration, release-please automation
71+
72+
## Configuration
73+
74+
The application uses `clive.yml` files with two main sections:
75+
- **settings**: Terminal appearance, browser options, timing defaults
76+
- **actions**: Sequence of terminal actions to execute (type, key, ctrl, sleep, pause, screenshot)
77+
78+
JSON schema validation ensures configuration correctness and provides IDE autocompletion.
79+
80+
## Testing Notes
81+
82+
- Uses testify framework for assertions and mocking
83+
- Custom mocks in `internal/net/mocks_test.go` for network components
84+
- Table-driven test patterns (see `util/int_test.go`)
85+
- `TestMain` functions for setup/teardown in test suites
86+
- Race detection enabled in CI pipeline
87+
- Configuration parsing has comprehensive test coverage including edge cases
88+
89+
## Release Process
90+
91+
Uses goreleaser for cross-platform binary distribution with multiple installation methods (Homebrew, go install, direct download).

0 commit comments

Comments
 (0)