This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the CUE language repository. CUE (Configure, Unify, Execute) is a general-purpose, strongly typed constraint-based language for data templating, validation, code generation, and scripting.
# Build and install the cue command
go install ./cmd/cue
# Build without installing
go build ./cmd/cue# Run all tests
# Any change to the repo should run all tests to ensure correctness.
go test ./...
# Run tests for a specific package
go test ./internal/core/adt
# Run a specific test function
go test -run TestEvalV2 ./internal/core/adt
# Run a specific testscript test
go test -run TestScript/eval_concrete ./cmd/cue/cmd
# Update golden test files (when output changes are expected)
CUE_UPDATE=1 go test ./...
# Run tests with race detector
go test -race ./...# Run go vet (catches common mistakes)
go vet ./...
# Run staticcheck (more comprehensive static analysis)
go tool -modfile=internal/tools.mod staticcheck ./...
# Format code (CUE uses standard Go formatting)
go fmt ./.../cue/- Core CUE language implementationast/- Abstract Syntax Treeparser/- Language parserload/- Package loading and importsformat/- Code formatting
/internal/core/- Core evaluation engineadt/- Core data structures and algorithmscompile/- Compilation logicdep/- Dependency analysisexport/- Export functionality
/cmd/cue/- CLI implementation for all CUE commands (eval, export, import, fmt, vet, mod, etc.)
/pkg/- Built-in packages (crypto, encoding, math, net, path, strings, etc.)
/encoding/- Encoders/decoders for JSON, YAML, TOML, Protobuf, OpenAPI, JSON Schema
- Test Format: Uses
.txtar(text archive) files containing input files and expected outputs - Test Organization: Unit tests alongside code (
*_test.go), integration tests intestdata/directories - Testscript Framework: Command-line integration tests in
/cmd/cue/cmd/testdata/script/
- Tests use the
.txtarformat which contains both input and expected output in a single file - Use
TestXfunctions in test files for debugging individual test cases - The
CUE_UPDATE=1environment variable updates golden files with actual output
- Single commit per PR/CL model
- Uses
git codereviewworkflow for managing changes - Runs
cueckoo runtrybot [CL|commit]to kick off CI testing. - Requires DCO (Developer Certificate of Origin) sign-off
- Both GitHub PRs and GerritHub CLs are supported
- Changes should be linked to a GitHub issue (except trivial changes)
- Module:
cuelang.org/go - Requires Go 1.24 or later
- Uses Go modules for dependency management
- Don't update copyright years in existing files
- Follow existing code style and patterns in the package you're modifying
- Check neighboring files for framework choices and conventions
- Use existing libraries and utilities rather than assuming new dependencies