7b3e94d6dc
- Add AgentSession database entity with SQLite persistence - Implement AgentSession CRUD operations in repository layer - Update executor to use hybrid cache + database approach - Add session restoration on startup (LoadActiveSessionsFromDB) - Link comments to agent sessions via agent_session_id - Fix SQLite NULL handling for nullable task fields - Add dev database setup with seed data (make dev, make dev-db-reset) - Update Makefile with dev targets for development mode This enables agent sessions to persist across backend restarts, solving the 'execution not found' error for resumed conversations.
134 lines
4.0 KiB
Makefile
134 lines
4.0 KiB
Makefile
# Kandev Makefile
|
|
|
|
# Variables
|
|
BINARY_NAME := kandev
|
|
BUILD_DIR := bin
|
|
GO := go
|
|
GOFLAGS := -v
|
|
LDFLAGS := -s -w
|
|
|
|
# Build info
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
|
COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
BUILD_TIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
|
|
|
|
LDFLAGS += -X main.Version=$(VERSION) -X main.Commit=$(COMMIT) -X main.BuildTime=$(BUILD_TIME)
|
|
|
|
.PHONY: all build clean run dev dev-db dev-db-reset test lint fmt vet help
|
|
|
|
## Default target
|
|
all: build
|
|
|
|
## Build the unified kandev binary
|
|
build:
|
|
@echo "Building $(BINARY_NAME)..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd/kandev
|
|
|
|
## Build all binaries (unified + individual services)
|
|
build-all: build
|
|
@echo "Building individual services..."
|
|
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/orchestrator ./cmd/orchestrator
|
|
$(GO) build $(GOFLAGS) -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/agent-manager ./cmd/agent-manager
|
|
|
|
## Clean build artifacts
|
|
clean:
|
|
@echo "Cleaning..."
|
|
@rm -rf $(BUILD_DIR)
|
|
$(GO) clean
|
|
|
|
## Run the application
|
|
run: build
|
|
@echo "Running $(BINARY_NAME)..."
|
|
./$(BUILD_DIR)/$(BINARY_NAME)
|
|
|
|
## Run in development mode with pre-seeded database
|
|
dev: build dev-db
|
|
@echo "Running $(BINARY_NAME) in development mode..."
|
|
KANDEV_DB_PATH=./dev/kandev-dev.db ./$(BUILD_DIR)/$(BINARY_NAME)
|
|
|
|
## Initialize/reset the development database
|
|
dev-db:
|
|
@if [ ! -f ./dev/kandev-dev.db ]; then \
|
|
echo "Initializing development database..."; \
|
|
./dev/init-db.sh; \
|
|
else \
|
|
echo "Development database already exists. Use 'make dev-db-reset' to recreate."; \
|
|
fi
|
|
|
|
## Reset the development database (recreate with fresh seed data)
|
|
dev-db-reset:
|
|
@echo "Resetting development database..."
|
|
./dev/init-db.sh --reset
|
|
|
|
## Run tests
|
|
test:
|
|
@echo "Running tests..."
|
|
$(GO) test -v ./...
|
|
|
|
## Run tests with coverage
|
|
test-coverage:
|
|
@echo "Running tests with coverage..."
|
|
$(GO) test -v -coverprofile=coverage.out ./...
|
|
$(GO) tool cover -html=coverage.out -o coverage.html
|
|
|
|
## Run linter (requires golangci-lint)
|
|
lint:
|
|
@echo "Running linter..."
|
|
golangci-lint run ./...
|
|
|
|
## Format code
|
|
fmt:
|
|
@echo "Formatting code..."
|
|
$(GO) fmt ./...
|
|
|
|
## Run go vet
|
|
vet:
|
|
@echo "Running vet..."
|
|
$(GO) vet ./...
|
|
|
|
## Tidy dependencies
|
|
tidy:
|
|
@echo "Tidying dependencies..."
|
|
$(GO) mod tidy
|
|
|
|
## Download dependencies
|
|
deps:
|
|
@echo "Downloading dependencies..."
|
|
$(GO) mod download
|
|
|
|
## Build for multiple platforms
|
|
build-cross:
|
|
@echo "Building for multiple platforms..."
|
|
@mkdir -p $(BUILD_DIR)
|
|
GOOS=linux GOARCH=amd64 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./cmd/kandev
|
|
GOOS=darwin GOARCH=amd64 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-amd64 ./cmd/kandev
|
|
GOOS=darwin GOARCH=arm64 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./cmd/kandev
|
|
GOOS=windows GOARCH=amd64 $(GO) build -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./cmd/kandev
|
|
|
|
## Show help
|
|
help:
|
|
@echo "Kandev - AI Agent Kanban Board"
|
|
@echo ""
|
|
@echo "Usage:"
|
|
@echo " make [target]"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " build Build the unified kandev binary (default)"
|
|
@echo " build-all Build all binaries (unified + individual services)"
|
|
@echo " clean Remove build artifacts"
|
|
@echo " run Build and run the application"
|
|
@echo " dev Run in development mode with pre-seeded database"
|
|
@echo " dev-db Initialize development database (if not exists)"
|
|
@echo " dev-db-reset Reset development database with fresh seed data"
|
|
@echo " test Run tests"
|
|
@echo " test-coverage Run tests with coverage report"
|
|
@echo " lint Run golangci-lint"
|
|
@echo " fmt Format code"
|
|
@echo " vet Run go vet"
|
|
@echo " tidy Tidy go.mod dependencies"
|
|
@echo " deps Download dependencies"
|
|
@echo " build-cross Build for Linux, macOS, and Windows"
|
|
@echo " help Show this help message"
|
|
|