This devcontainer provides a complete development environment for the Kosli CLI project.
- Go 1.25 - Primary development language
- Node.js LTS - For npm package management and release
- golangci-lint - Go linting and static analysis
- goreleaser - Release automation
- gotestsum - Enhanced Go test runner
- Hugo Extended - Documentation site generation
- GitHub CLI (gh) - GitHub integration
- Docker-in-Docker - For integration tests (runs Kosli server)
- Make - Build automation
- Git - Version control
-
Open in VS Code
- Install the "Dev Containers" extension
- Open this repository in VS Code
- Click "Reopen in Container" when prompted (or use Command Palette: "Dev Containers: Reopen in Container")
-
Wait for Setup
- The container will build (first time takes a few minutes)
- Post-create commands will run automatically (
go mod download, etc.)
-
Start Developing
# Build the CLI make build # Run tests make test_integration # Run linting make lint # Build documentation make hugo-local
- 1515 - Hugo documentation server
- 8001 - Local Kosli server (for integration tests)
- Go module cache is persisted in a Docker volume for faster builds
- Docker socket is mounted for Docker-in-Docker functionality
The following extensions are automatically installed:
- Go - Go language support
- Docker - Docker file and container management
- GitLens - Enhanced Git capabilities
Pre-configured with:
- Go formatting on save
- Automatic import organization
- golangci-lint integration
- Go language server (gopls)
make build
./kosli version# Integration tests (requires Docker)
make test_integration
# Run all tests including slow ones
make test_integration_full
# Run specific test suite
make test_integration_single TARGET=TestAttestJunitCommandTestSuite# Test npm package installation locally
npm install
npm test
# Pack for distribution
npm pack
# Test the packed version
mkdir /tmp/npm-test && cd /tmp/npm-test
npm install /workspace/*.tgz
npx kosli version# Generate CLI documentation
make cli-docs
# Start Hugo documentation server (accessible at localhost:1515)
make hugo-localmake lintThe following environment variables are pre-configured:
CGO_ENABLED=0- Disable CGO for static binariesGO111MODULE=on- Use Go modulesGOPATH=/go- Go workspace location
You need to set KOSLI_API_TOKEN_PROD for integration tests:
export KOSLI_API_TOKEN_PROD="your-token-here"The devcontainer uses Docker-in-Docker to run integration tests. The Kosli server runs in a container alongside your tests.
# View server logs
make logs_integration_test_server
# Follow server logs
make follow_integration_test_server
# Enter server container
make enter_integration_test_server- Ensure Docker Desktop is running
- Check Docker has enough resources (4GB+ RAM recommended)
- Try rebuilding: Command Palette → "Dev Containers: Rebuild Container"
- Ensure
KOSLI_API_TOKEN_PRODis set - Check Docker is working:
docker ps - Verify network:
docker network ls(should seecli_net)
go clean -modcache
go mod download
go mod tidyrm -rf node_modules package-lock.json
npm installEdit .devcontainer/devcontainer.json:
"extensions": [
"golang.go",
"your-extension-id"
]Edit .devcontainer/Dockerfile and rebuild the container.
Edit the remoteEnv section in .devcontainer/devcontainer.json.
The container runs as the vscode user (non-root) for security. Use sudo if you need root access:
sudo apt-get install some-package