Imported from compose-network/local-testnet (
AGENTS.md). Install upstream withnpx skills add compose-network/local-testnet. Copyright stays with the author.
Repository Guidelines
This Go 1.25 project orchestrates a local L1/L2 stack for Compose Network contributors. Follow the practices below to keep the control plane predictable and easy to debug.
Project Structure & Module Organization
cmd/localnetcontains the Cobra CLI entry point that wires configuration and subcommands.internal/l1,internal/l2, andinternal/observabilityhost service-specific orchestration logic; shared logging lives ininternal/logger.configs/stores the source-of-truthconfig.yamlplus per-service templates consumed at runtime.services/holds container assets (Dockerfiles, Kurtosis bundles), whilestate/is generated during runs and may be safely wiped.- Tests live beside their packages as Go
_test.gofiles; architecture notes sit indocs/.
Build, Test, and Development Commands
make buildcompiles the CLI tocmd/localnet/bin/localnet.make runstarts the CLI with the default stack; usemake run-l1,make run-l2, ormake run-observabilityfor targeted bring-up.make testexecutesgo test ./....make lintrunsgolangci-lintwith.golangci.ymldefaults.make clean,make clean-l1, andmake clean-l2tear down Docker/Kurtosis resources and clearstate/.
Coding Style & Naming Conventions
- Always format Go code with
gofmt(tabs for indentation, single blank line between logical blocks) before sending a review. - Adopt Go naming: exported types/functions use PascalCase, private helpers use lowerCamelCase, and constants remain in ALL_CAPS when shared.
- Prefer structured logging via
slogfrominternal/loggerand load configs throughconfigs.Valuesrather than manual file reads.
Testing Guidelines
- Place unit and integration tests in the same package using
_test.gofiles with functions likeTestCommand_Run. - Favour table-driven tests for multi-scenario coverage and assert external effects via temporary directories instead of mutating
state/. - Run
make testbefore pushing; include Kurtosis/Docker smoke checks when touching deployment logic.
Commit & Pull Request Guidelines
- Use short, imperative commit subjects (
Refine L2 slot sync) following the existing history style, and group related changes logically. - For pull requests, provide: purpose, touched services (
l1,l2,observability), manual test results or logs, and references to issues/spec tickets. - Screenshot CLI output or
docker pssummaries when UI-visible behavior changes, and call out required config tweaks inconfigs/config.yaml.