This guide covers building and testing the SMALL CLI during development.
Build a local binary without installing globally:
go build -o ./bin/small ./cmd/small
./bin/small --helpAfter modifying CLI code, you must rebuild before changes take effect:
go build -o ./bin/small ./cmd/small
./bin/small [command]Important: The binary is statically linked. Changes to Go source files require a rebuild.
Run the full test suite:
go test ./...Run tests for a specific package:
go test ./internal/commands -v
go test ./internal/small -vRun a specific test:
go test -run TestGenerateReplayId ./internal/commands -vTo use small commands from anywhere during development, install to your $GOPATH/bin:
go build -o ~/go/bin/small ./cmd/smallVerify installation:
which small
small --helpAfter making changes and rebuilding, update the global binary:
go build -o ~/go/bin/small ./cmd/smallNote on shell caching: If you've already run small in your shell session, it may cache the old binary location. Clear the cache:
hash -r
small --helpIf small shows old behavior after updating:
-
Check which binary is being used:
which small
-
If multiple versions exist, your
PATHorder matters. Your~/go/bintypically comes before/usr/local/bin. -
Always build to your active
$GOPATH/bin(usually~/go/bin/small), not/usr/local/bin.
If you modify schemas in spec/small/v1.0.0/schemas/, you must sync them to the embedded location:
make sync-schemasThen rebuild:
go build -o ~/go/bin/small ./cmd/smallBefore committing or testing:
# Validate all artifacts
small validate
# Check invariants
small lint --strict
# Verify CI gates pass
small verify --ci- Create
internal/commands/mycommand.gowith amycommandCmd()function - Register it in
internal/commands/root.go:rootCmd.AddCommand(mycommandCmd())
- Add tests in
internal/commands/mycommand_test.go - Rebuild:
go build -o ~/go/bin/small ./cmd/small
- Edit
spec/small/v1.0.0/schemas/*.json - Sync to embedded copy:
make sync-schemas - Update tests if behavior changed
- Rebuild:
go build -o ~/go/bin/small ./cmd/small - Run
go test ./...to verify
Use the local binary without installing globally:
./bin/small init --intent "test"
./bin/small validate
./bin/small handoffCommon development targets:
make small-build # Build the CLI
make small-test # Run all tests
make small-format # Format code
make small-validate # Validate examples
make sync-schemas # Sync schemas to embedded locationSee the Makefile for complete list.