Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Development Setup

Set up a local development environment for building with SixDegree.

Prerequisites

Required Software

  • Go 1.23 or later
  • Docker and Docker Compose
  • Git
  • Database setup (contact maintainers for requirements)
  • kubectl - Kubernetes CLI (for testing deployments)
  • degree - SixDegree CLI
  • curl or httpie - API testing
  • jq - JSON processing

Installing SixDegree CLI

macOS

brew install sixdegree-ai/tap/degree

Linux

curl -sL https://cli.sixdegree.ai/install.sh | bash

From Source

git clone https://github.com/sixdegree-ai/cli
cd cli
go build -o degree
sudo mv degree /usr/local/bin/

Verify Installation

degree version

Database Setup

Contact the platform maintainers for database setup instructions and schema initialization scripts. The development environment requires a graph database backend with specific extensions.

Running the Platform Locally

Clone Repositories

# Create workspace
mkdir sixdegree-dev
cd sixdegree-dev

# Clone platform
git clone https://github.com/sixdegree-ai/platform
cd platform

# Clone molecules
git clone https://github.com/sixdegree-ai/molecules

Configure Environment

Create .env file in platform directory:

# Database
DATABASE_URL=${DATABASE_URL}

# Server
PORT=8080
LOG_LEVEL=debug

# Authentication (for local dev, use a test secret)
JWT_SECRET=dev_secret_change_in_production
CLERK_SECRET_KEY=your_clerk_secret_key

# Features
ENABLE_DISCOVERY=true
ENABLE_MCP=true

Build and Run

cd platform

# Install dependencies
go mod download

# Run database migrations
go run cmd/migrate/main.go up

# Start platform server
go run cmd/server/main.go

The platform API will be available at http://localhost:8080.

Verify Platform is Running

# Health check
curl http://localhost:8080/health

# Expected response
{"status":"ok","version":"dev"}

Development Workflow

Hot Reloading

Use air for automatic reloading:

# Install air
go install github.com/air-verse/air@latest

# Run with hot reload
air

Create .air.toml:

root = "."
tmp_dir = "tmp"

[build]
bin = "./tmp/main"
cmd = "go build -o ./tmp/main cmd/server/main.go"
delay = 1000
exclude_dir = ["assets", "tmp", "vendor", "node_modules"]
exclude_file = []
exclude_regex = ["_test.go"]
exclude_unchanged = false
follow_symlink = false
include_dir = []
include_ext = ["go", "tpl", "tmpl", "html"]
kill_delay = "0s"
log = "build-errors.log"
send_interrupt = false
stop_on_error = true

[color]
app = ""
build = "yellow"
main = "magenta"
runner = "green"
watcher = "cyan"

[log]
time = false

[misc]
clean_on_exit = false

Running Tests

# Run all tests
go test ./...

# Run specific package
go test ./pkg/graph

# Run with coverage
go test -cover ./...

# Generate coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

Code Quality

Linting

# Install golangci-lint
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

# Run linter
golangci-lint run

Formatting

# Format code
go fmt ./...

# Check formatting
gofmt -l .

Static Analysis

# Run go vet
go vet ./...

# Run staticcheck
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...

IDE Setup

VS Code

Install recommended extensions:

{
"recommendations": [
"golang.go",
"ms-azuretools.vscode-docker",
"ms-kubernetes-tools.vscode-kubernetes-tools",
"GitHub.copilot",
"eamodio.gitlens"
]
}

Configure settings (.vscode/settings.json):

{
"go.useLanguageServer": true,
"go.lintTool": "golangci-lint",
"go.lintOnSave": "workspace",
"go.formatTool": "gofmt",
"go.testFlags": ["-v"],
"editor.formatOnSave": true,
"[go]": {
"editor.codeActionsOnSave": {
"source.organizeImports": true
}
}
}

GoLand / IntelliJ IDEA

  1. Open project directory
  2. Enable Go modules support
  3. Configure database connection per setup instructions
  4. Set up Run Configuration:
    • Go Build: cmd/server/main.go
    • Working directory: project root
    • Environment: Load from .env file

Debugging

VS Code Launch Configuration

Create .vscode/launch.json:

{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Server",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/server/main.go",
"env": {
"DATABASE_URL": "${DATABASE_URL}",
"PORT": "8080",
"LOG_LEVEL": "debug"
},
"args": []
},
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": "${command:pickProcess}"
},
{
"name": "Run Tests",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}",
"env": {
"DATABASE_URL": "${DATABASE_URL}_test"
}
}
]
}

Delve (Go Debugger)

# Install delve
go install github.com/go-delve/delve/cmd/dlv@latest

# Debug server
dlv debug cmd/server/main.go

# Debug tests
dlv test ./pkg/graph

Working with Molecules

Running Molecules Locally

cd molecules/github

# Install dependencies
go mod download

# Build molecule
go build -o github-molecule

# Run discovery
./github-molecule discover --config test-config.yaml --dry-run

# Start molecule server
./github-molecule serve --port 8081

Testing Molecule Discovery

# Create test configuration
cat > test-config.yaml <<EOF
discovery:
enabled: true
settings:
token: "your_github_token"
selectors:
- organization: "sixdegree-ai"
repo_pattern: ".*"

namespace: "test"
EOF

# Run discovery
./github-molecule discover --config test-config.yaml --dry-run

Using Doppelganger Mock Server

The Doppelganger mock server simulates external APIs for testing:

cd doppelganger

# Start mock server
go run main.go

# Mock server runs on http://localhost:9090

Configure molecule to use mock server:

discovery:
settings:
api_url: "http://localhost:9090/github"
token: "mock-token"

Environment Variables Reference

VariableDescriptionDefault
DATABASE_URLDatabase connection stringRequired
PORTServer port8080
LOG_LEVELLogging level (debug, info, warn, error)info
JWT_SECRETJWT signing secretRequired
CLERK_SECRET_KEYClerk authentication secretRequired
ENABLE_DISCOVERYEnable discovery featurestrue
ENABLE_MCPEnable MCP featurestrue
CORS_ALLOWED_ORIGINSAllowed CORS origins*

Troubleshooting

Database Connection Issues

# Test connection
psql ${DATABASE_URL}

# Check if PostgreSQL is running
brew services list | grep postgresql # macOS
systemctl status postgresql # Linux

# Check if port 5432 is available
lsof -i :5432

Port Already in Use

# Find process using port 8080
lsof -i :8080

# Kill process
kill -9 <PID>

Module Download Failures

# Clear module cache
go clean -modcache

# Update dependencies
go mod tidy
go mod download

Next Steps