build: update Makefile for opsctl, devcontainer, and config
- Makefile: delegate phony targets to opsctl, add OPSCTL_BIN - .devcontainer/Dockerfile, devcontainer.json: build env updates - config/config.example.json: example config tweaks
This commit is contained in:
parent
097f87f37f
commit
2dc17fbd02
4 changed files with 149 additions and 223 deletions
|
|
@ -1,5 +1,10 @@
|
||||||
FROM golang:1.26-bookworm
|
FROM golang:1.26-bookworm AS go-tools
|
||||||
|
ENV CGO_ENABLED=1
|
||||||
|
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
|
||||||
|
|
||||||
|
FROM node:22-bookworm-slim AS app
|
||||||
|
|
||||||
|
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
ARG USERNAME=vscode
|
ARG USERNAME=vscode
|
||||||
ARG USER_UID=1000
|
ARG USER_UID=1000
|
||||||
|
|
@ -8,26 +13,43 @@ ARG USER_GID=1000
|
||||||
RUN apt-get update \
|
RUN apt-get update \
|
||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
bash \
|
bash \
|
||||||
|
build-essential \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
flatbuffers-compiler \
|
flatbuffers-compiler \
|
||||||
git \
|
git \
|
||||||
jq \
|
jq \
|
||||||
make \
|
make \
|
||||||
nodejs \
|
pkg-config \
|
||||||
npm \
|
|
||||||
unzip \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN groupadd --gid "${USER_GID}" "${USERNAME}" \
|
COPY --from=go-tools /usr/local/go /usr/local/go
|
||||||
&& useradd --uid "${USER_UID}" --gid "${USER_GID}" -m "${USERNAME}" \
|
COPY --from=go-tools /go/bin/sqlc /usr/local/bin/sqlc
|
||||||
&& mkdir -p /workspaces \
|
|
||||||
&& chown -R "${USERNAME}:${USERNAME}" /workspaces
|
ENV CGO_ENABLED=1 \
|
||||||
|
GOPATH=/home/${USERNAME}/go \
|
||||||
|
PATH=/usr/local/go/bin:/home/${USERNAME}/go/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
|
|
||||||
|
RUN ln -s /usr/local/go/bin/go /usr/local/bin/go \
|
||||||
|
&& ln -s /usr/local/go/bin/gofmt /usr/local/bin/gofmt
|
||||||
|
|
||||||
|
RUN set -eu; \
|
||||||
|
if ! getent group "${USER_GID}" >/dev/null 2>&1; then \
|
||||||
|
groupadd --gid "${USER_GID}" "${USERNAME}"; \
|
||||||
|
fi; \
|
||||||
|
if id -u "${USER_UID}" >/dev/null 2>&1; then \
|
||||||
|
existing_user="$(id -un "${USER_UID}")"; \
|
||||||
|
if [ "${existing_user}" != "${USERNAME}" ]; then \
|
||||||
|
usermod -l "${USERNAME}" -d "/home/${USERNAME}" -m "${existing_user}"; \
|
||||||
|
fi; \
|
||||||
|
elif ! id -u "${USERNAME}" >/dev/null 2>&1; then \
|
||||||
|
useradd --uid "${USER_UID}" --gid "${USER_GID}" --create-home --shell /bin/bash --non-unique "${USERNAME}"; \
|
||||||
|
else \
|
||||||
|
usermod -u "${USER_UID}" "${USERNAME}" --non-unique; \
|
||||||
|
fi; \
|
||||||
|
usermod -g "${USER_GID}" "${USERNAME}" || true; \
|
||||||
|
mkdir -p /workspaces /home/${USERNAME}/go; \
|
||||||
|
chown -R "${USERNAME}:${USER_GID}" /workspaces /home/${USERNAME} /home/${USERNAME}/go
|
||||||
|
|
||||||
USER ${USERNAME}
|
USER ${USERNAME}
|
||||||
ENV GOPATH=/home/${USERNAME}/go
|
WORKDIR /workspaces/${USERNAME}
|
||||||
ENV PATH=${GOPATH}/bin:${PATH}
|
|
||||||
RUN go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,12 @@
|
||||||
},
|
},
|
||||||
"remoteUser": "vscode",
|
"remoteUser": "vscode",
|
||||||
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
|
||||||
|
"mounts": [
|
||||||
|
"source=${localEnv:HOME},target=/host_home,type=bind,readonly"
|
||||||
|
],
|
||||||
|
"containerEnv": {
|
||||||
|
"DRAGONSCALE_EVAL_HOST_HOME": "/host_home"
|
||||||
|
},
|
||||||
"postCreateCommand": "make deps",
|
"postCreateCommand": "make deps",
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
|
|
|
||||||
312
Makefile
312
Makefile
|
|
@ -1,6 +1,8 @@
|
||||||
.PHONY: all build install uninstall clean help test lint hooks \
|
.PHONY: all build generate build-all install uninstall uninstall-all clean help \
|
||||||
fantasy-check fantasy-diff fantasy-sync fantasy-patch \
|
test lint hooks fmt deps update-deps sqlc-check flatc-check sqlc-vet \
|
||||||
flatc-check devcontainer-up devcontainer-build devcontainer-generate devcontainer-verify
|
fantasy-check fantasy-diff fantasy-sync fantasy-patch test-integration check run \
|
||||||
|
devcontainer-up devcontainer-build devcontainer-generate devcontainer-verify \
|
||||||
|
eval-build eval eval-fixtures eval-view eval-clean eval-compare eval-test
|
||||||
|
|
||||||
# Build variables
|
# Build variables
|
||||||
BINARY_NAME=dragonscale
|
BINARY_NAME=dragonscale
|
||||||
|
|
@ -12,25 +14,40 @@ MAIN_GO=$(CMD_DIR)/main.go
|
||||||
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
VERSION?=$(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
||||||
GIT_COMMIT=$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo "dev")
|
GIT_COMMIT=$(shell git rev-parse --short=8 HEAD 2>/dev/null || echo "dev")
|
||||||
BUILD_TIME=$(shell date +%FT%T%z)
|
BUILD_TIME=$(shell date +%FT%T%z)
|
||||||
GO_VERSION=$(shell $(PIPELINE_GO) version | awk '{print $$3}')
|
GO_VERSION=$(shell $(GO) version | awk '{print $$3}')
|
||||||
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.buildTime=$(BUILD_TIME) -X main.goVersion=$(GO_VERSION) -s -w"
|
LDFLAGS=-ldflags "-X main.version=$(VERSION) -X main.gitCommit=$(GIT_COMMIT) -X main.buildTime=$(BUILD_TIME) -X main.goVersion=$(GO_VERSION) -s -w"
|
||||||
|
|
||||||
# Go variables
|
# Go variables
|
||||||
GO?=go
|
GO?=go
|
||||||
GOFLAGS?=-v -trimpath -tags stdjson
|
GOFLAGS?=-v -trimpath -tags stdjson
|
||||||
|
CGO_ENABLED?=1
|
||||||
|
MAKEFILE_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||||
|
DEVCONTAINER_WORKSPACE ?= $(MAKEFILE_DIR)
|
||||||
|
|
||||||
# Go command execution can optionally run through the devcontainer to match build env.
|
# Go command execution can optionally run through the devcontainer to match build env.
|
||||||
HAS_NPX := $(shell command -v npx >/dev/null 2>&1; echo $$?)
|
HAS_NPX := $(shell command -v npx >/dev/null 2>&1; echo $$?)
|
||||||
DEVCONTAINER_EXEC ?=
|
DEVCONTAINER_EXEC ?=
|
||||||
|
IN_DOCKER := $(strip $(shell [ -f /.dockerenv ] && echo 1))
|
||||||
|
DEVCONTAINER_CLI := npx --yes @devcontainers/cli
|
||||||
|
DEVCONTAINER_UP_CMD := $(DEVCONTAINER_CLI) up --workspace-folder "$(DEVCONTAINER_WORKSPACE)"
|
||||||
|
DEVCONTAINER_EXEC_CMD := $(DEVCONTAINER_CLI) exec --workspace-folder "$(DEVCONTAINER_WORKSPACE)"
|
||||||
|
CGO_ENV=CGO_ENABLED=$(CGO_ENABLED)
|
||||||
ifeq ($(strip $(DEVCONTAINER_EXEC)),)
|
ifeq ($(strip $(DEVCONTAINER_EXEC)),)
|
||||||
ifeq ($(HAS_NPX),0)
|
ifneq ($(strip $(IN_DOCKER)),1)
|
||||||
DEVCONTAINER_EXEC := npx --yes @devcontainers/cli exec --workspace-folder .
|
ifneq ($(strip $(shell test -d "$(DEVCONTAINER_WORKSPACE)/.devcontainer" && echo ok)),)
|
||||||
|
DEVCONTAINER_EXEC := $(DEVCONTAINER_UP_CMD) && $(DEVCONTAINER_EXEC_CMD)
|
||||||
|
else ifeq ($(HAS_NPX),0)
|
||||||
|
DEVCONTAINER_EXEC := $(DEVCONTAINER_UP_CMD) && $(DEVCONTAINER_EXEC_CMD)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
ifeq ($(strip $(DEVCONTAINER_EXEC)),)
|
||||||
|
DEVCONTAINER_EXEC :=
|
||||||
|
endif
|
||||||
EVAL_BASH := $(if $(DEVCONTAINER_EXEC),$(DEVCONTAINER_EXEC) -- bash -lc,bash -lc)
|
EVAL_BASH := $(if $(DEVCONTAINER_EXEC),$(DEVCONTAINER_EXEC) -- bash -lc,bash -lc)
|
||||||
PIPELINE_GO := $(if $(DEVCONTAINER_EXEC),$(DEVCONTAINER_EXEC) -- bash -lc 'git config --global --add safe.directory "$$PWD" >/dev/null 2>&1 || true; $(GO) "$$0" "$$@"',$(GO))
|
PIPELINE_GO := $(if $(DEVCONTAINER_EXEC),$(DEVCONTAINER_EXEC) -- bash -lc 'git config --global --add safe.directory "$$PWD" >/dev/null 2>&1 || true; $(CGO_ENV) $(GO) "$$0" "$$@"',$(CGO_ENV) $(GO))
|
||||||
EVAL_GO := $(PIPELINE_GO)
|
EVAL_GO := $(PIPELINE_GO)
|
||||||
EVAL_NPM := npx
|
EVAL_NPM := npx --yes
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
INSTALL_PREFIX?=$(HOME)/.local
|
INSTALL_PREFIX?=$(HOME)/.local
|
||||||
|
|
@ -77,284 +94,165 @@ endif
|
||||||
|
|
||||||
BINARY_PATH=$(BUILD_DIR)/$(BINARY_NAME)-$(PLATFORM)-$(ARCH)
|
BINARY_PATH=$(BUILD_DIR)/$(BINARY_NAME)-$(PLATFORM)-$(ARCH)
|
||||||
|
|
||||||
|
# Compatibility shim: run everything through the Go wrapper.
|
||||||
|
OPSCTL_BIN = bin/opsctl
|
||||||
|
OPSCTL ?= $(OPSCTL_BIN)
|
||||||
|
|
||||||
|
$(OPSCTL_BIN):
|
||||||
|
@mkdir -p $(dir $(OPSCTL_BIN))
|
||||||
|
@go build -o $(OPSCTL_BIN) ./cmd/opsctl
|
||||||
|
|
||||||
# Default target
|
# Default target
|
||||||
all: build
|
all: build
|
||||||
|
|
||||||
## generate: Run generate
|
## generate: Run generate
|
||||||
generate:
|
generate: $(OPSCTL_BIN)
|
||||||
@echo "Run generate..."
|
@$(OPSCTL) generate
|
||||||
@rm -r ./$(CMD_DIR)/workspace 2>/dev/null || true
|
|
||||||
@$(PIPELINE_GO) generate ./...
|
|
||||||
@echo "Run generate complete"
|
|
||||||
|
|
||||||
## build: Build the dragonscale binary for current platform
|
## build: Build the dragonscale binary for current platform
|
||||||
build: generate
|
build: $(OPSCTL_BIN)
|
||||||
@echo "Building $(BINARY_NAME) for $(PLATFORM)/$(ARCH)..."
|
@$(OPSCTL) build
|
||||||
@mkdir -p $(BUILD_DIR)
|
|
||||||
@$(PIPELINE_GO) build $(GOFLAGS) $(LDFLAGS) -o $(BINARY_PATH) ./$(CMD_DIR)
|
|
||||||
@echo "Build complete: $(BINARY_PATH)"
|
|
||||||
@ln -sf $(BINARY_NAME)-$(PLATFORM)-$(ARCH) $(BUILD_DIR)/$(BINARY_NAME)
|
|
||||||
|
|
||||||
## build-all: Build dragonscale for all platforms
|
## build-all: Build dragonscale for all platforms
|
||||||
build-all: generate
|
build-all: $(OPSCTL_BIN)
|
||||||
@echo "Building for multiple platforms..."
|
@$(OPSCTL) build-all
|
||||||
@mkdir -p $(BUILD_DIR)
|
|
||||||
GOOS=linux GOARCH=amd64 $(PIPELINE_GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-amd64 ./$(CMD_DIR)
|
|
||||||
GOOS=linux GOARCH=arm64 $(PIPELINE_GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-arm64 ./$(CMD_DIR)
|
|
||||||
GOOS=linux GOARCH=loong64 $(PIPELINE_GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-loong64 ./$(CMD_DIR)
|
|
||||||
GOOS=linux GOARCH=riscv64 $(PIPELINE_GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-linux-riscv64 ./$(CMD_DIR)
|
|
||||||
GOOS=darwin GOARCH=arm64 $(PIPELINE_GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-darwin-arm64 ./$(CMD_DIR)
|
|
||||||
GOOS=windows GOARCH=amd64 $(PIPELINE_GO) build $(LDFLAGS) -o $(BUILD_DIR)/$(BINARY_NAME)-windows-amd64.exe ./$(CMD_DIR)
|
|
||||||
@echo "All builds complete"
|
|
||||||
|
|
||||||
## install: Install dragonscale to system and copy builtin skills
|
## install: Install dragonscale to system and copy builtin skills
|
||||||
install: build
|
install: $(OPSCTL_BIN)
|
||||||
@echo "Installing $(BINARY_NAME)..."
|
@$(OPSCTL) install
|
||||||
@mkdir -p $(INSTALL_BIN_DIR)
|
|
||||||
@cp $(BUILD_DIR)/$(BINARY_NAME) $(INSTALL_BIN_DIR)/$(BINARY_NAME)
|
|
||||||
@chmod +x $(INSTALL_BIN_DIR)/$(BINARY_NAME)
|
|
||||||
@echo "Installed binary to $(INSTALL_BIN_DIR)/$(BINARY_NAME)"
|
|
||||||
@echo "Installation complete!"
|
|
||||||
|
|
||||||
## uninstall: Remove dragonscale from system
|
## uninstall: Remove dragonscale from system
|
||||||
uninstall:
|
uninstall: $(OPSCTL_BIN)
|
||||||
@echo "Uninstalling $(BINARY_NAME)..."
|
@$(OPSCTL) uninstall
|
||||||
@rm -f $(INSTALL_BIN_DIR)/$(BINARY_NAME)
|
|
||||||
@echo "Removed binary from $(INSTALL_BIN_DIR)/$(BINARY_NAME)"
|
|
||||||
@echo "Note: Only the executable file has been deleted."
|
|
||||||
@echo "If you need to delete all configurations (config.json, workspace, etc.), run 'make uninstall-all'"
|
|
||||||
|
|
||||||
## uninstall-all: Remove dragonscale and all data
|
## uninstall-all: Remove dragonscale and all data
|
||||||
uninstall-all:
|
uninstall-all: $(OPSCTL_BIN)
|
||||||
@echo "Removing workspace and skills..."
|
@$(OPSCTL) uninstall-all
|
||||||
@rm -rf $(DRAGONSCALE_HOME)
|
|
||||||
@echo "Removed workspace: $(DRAGONSCALE_HOME)"
|
|
||||||
@echo "Complete uninstallation done!"
|
|
||||||
|
|
||||||
## clean: Remove build artifacts
|
## clean: Remove build artifacts
|
||||||
clean:
|
clean: $(OPSCTL_BIN)
|
||||||
@echo "Cleaning build artifacts..."
|
@$(OPSCTL) clean
|
||||||
@rm -rf $(BUILD_DIR)
|
|
||||||
@echo "Clean complete"
|
|
||||||
|
|
||||||
## vet: Run go vet for static analysis
|
## vet: Run go vet for static analysis
|
||||||
vet:
|
vet: $(OPSCTL_BIN)
|
||||||
@$(PIPELINE_GO) vet ./...
|
@$(OPSCTL) vet
|
||||||
|
|
||||||
## test: Run tests
|
## test: Run tests
|
||||||
test:
|
test: $(OPSCTL_BIN)
|
||||||
@$(PIPELINE_GO) test ./...
|
@$(OPSCTL) test
|
||||||
|
|
||||||
## fmt: Format Go code
|
## fmt: Format Go code
|
||||||
fmt:
|
fmt: $(OPSCTL_BIN)
|
||||||
@$(PIPELINE_GO) fmt ./...
|
@$(OPSCTL) fmt
|
||||||
|
|
||||||
## lint: Run all linting checks (format + vet + build)
|
## lint: Run all linting checks (format + vet + build)
|
||||||
lint: fmt vet
|
lint: $(OPSCTL_BIN)
|
||||||
@$(PIPELINE_GO) build ./...
|
@$(OPSCTL) lint
|
||||||
@echo "Lint OK"
|
|
||||||
|
|
||||||
## hooks: Install git pre-commit and commit-msg hooks
|
## hooks: Install git pre-commit and commit-msg hooks
|
||||||
hooks:
|
hooks: $(OPSCTL_BIN)
|
||||||
@echo "Installing git hooks..."
|
@$(OPSCTL) hooks
|
||||||
@ln -sf ../../scripts/hooks/pre-commit .git/hooks/pre-commit
|
|
||||||
@ln -sf ../../scripts/hooks/commit-msg .git/hooks/commit-msg
|
|
||||||
@chmod +x .git/hooks/pre-commit .git/hooks/commit-msg
|
|
||||||
@echo " ✓ pre-commit → scripts/hooks/pre-commit"
|
|
||||||
@echo " ✓ commit-msg → scripts/hooks/commit-msg"
|
|
||||||
@echo "Hooks installed. Skip with: git commit --no-verify"
|
|
||||||
|
|
||||||
## deps: Download dependencies
|
## deps: Download dependencies
|
||||||
deps:
|
deps: $(OPSCTL_BIN)
|
||||||
@$(PIPELINE_GO) mod download
|
@$(OPSCTL) deps
|
||||||
@$(PIPELINE_GO) mod verify
|
|
||||||
|
|
||||||
## update-deps: Update dependencies
|
## update-deps: Update dependencies
|
||||||
update-deps:
|
update-deps: $(OPSCTL_BIN)
|
||||||
@$(PIPELINE_GO) get -u ./...
|
@$(OPSCTL) update-deps
|
||||||
@$(PIPELINE_GO) mod tidy
|
|
||||||
|
|
||||||
## sqlc-check: Verify sqlc generation is idempotent for current tree
|
## sqlc-check: Verify sqlc generation is idempotent for current tree
|
||||||
sqlc-check:
|
sqlc-check: $(OPSCTL_BIN)
|
||||||
@echo "Checking sqlc generation..."
|
@$(OPSCTL) sqlc-check
|
||||||
@set -e; repo="$$(pwd)"; before="$$(mktemp)"; after="$$(mktemp)"; \
|
|
||||||
snapshot() { \
|
|
||||||
git -c safe.directory="$$repo" diff --binary -- pkg/memory/sqlc/; \
|
|
||||||
git -c safe.directory="$$repo" ls-files --others --exclude-standard -- pkg/memory/sqlc/ | LC_ALL=C sort | while IFS= read -r f; do \
|
|
||||||
[ -f "$$f" ] && sha256sum "$$f"; \
|
|
||||||
done; \
|
|
||||||
}; \
|
|
||||||
snapshot > "$$before"; \
|
|
||||||
sqlc generate -f pkg/memory/sqlc/sqlc.yaml; \
|
|
||||||
snapshot > "$$after"; \
|
|
||||||
if ! cmp -s "$$before" "$$after"; then \
|
|
||||||
echo "::error::sqlc generated code is stale. Run 'sqlc generate -f pkg/memory/sqlc/sqlc.yaml' and commit."; \
|
|
||||||
rm -f "$$before" "$$after"; \
|
|
||||||
exit 1; \
|
|
||||||
fi; \
|
|
||||||
rm -f "$$before" "$$after"
|
|
||||||
@echo "sqlc OK"
|
|
||||||
|
|
||||||
## flatc-check: Verify FlatBuffers generation is idempotent for current tree
|
## flatc-check: Verify FlatBuffers generation is idempotent for current tree
|
||||||
flatc-check:
|
flatc-check: $(OPSCTL_BIN)
|
||||||
@echo "Checking flatc generation..."
|
@$(OPSCTL) flatc-check
|
||||||
@set -e; repo="$$(pwd)"; before="$$(mktemp)"; after="$$(mktemp)"; \
|
|
||||||
snapshot() { \
|
|
||||||
git -c safe.directory="$$repo" diff --binary -- pkg/itr/itrfb/ pkg/tools/mapopsfb/; \
|
|
||||||
git -c safe.directory="$$repo" ls-files --others --exclude-standard -- pkg/itr/itrfb/ pkg/tools/mapopsfb/ | LC_ALL=C sort | while IFS= read -r f; do \
|
|
||||||
[ -f "$$f" ] && sha256sum "$$f"; \
|
|
||||||
done; \
|
|
||||||
}; \
|
|
||||||
snapshot > "$$before"; \
|
|
||||||
$(PIPELINE_GO) generate ./pkg/itr ./pkg/tools; \
|
|
||||||
snapshot > "$$after"; \
|
|
||||||
if ! cmp -s "$$before" "$$after"; then \
|
|
||||||
echo "::error::FlatBuffers generated code is stale. Run 'go generate ./pkg/itr ./pkg/tools' and commit."; \
|
|
||||||
rm -f "$$before" "$$after"; \
|
|
||||||
exit 1; \
|
|
||||||
fi; \
|
|
||||||
rm -f "$$before" "$$after"
|
|
||||||
@echo "flatc OK"
|
|
||||||
|
|
||||||
## sqlc-vet: Run sqlc vet rules (no-unbounded-delete, one-select-requires-limit-1)
|
## sqlc-vet: Run sqlc vet rules (no-unbounded-delete, one-select-requires-limit-1)
|
||||||
sqlc-vet:
|
sqlc-vet: $(OPSCTL_BIN)
|
||||||
@echo "Running sqlc vet..."
|
@$(OPSCTL) sqlc-vet
|
||||||
@sqlc vet -f pkg/memory/sqlc/sqlc.yaml
|
|
||||||
@echo "sqlc vet OK"
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Fantasy SDK vendor management
|
# Fantasy SDK vendor management
|
||||||
# Usage: make fantasy-diff FANTASY_VERSION=v0.9.0
|
|
||||||
# make fantasy-sync FANTASY_VERSION=v0.9.0
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
FANTASY_VERSION ?=
|
FANTASY_VERSION ?=
|
||||||
|
|
||||||
## fantasy-check: Compare vendored Fantasy SDK against latest upstream
|
## fantasy-check: Compare vendored Fantasy SDK against latest upstream
|
||||||
fantasy-check:
|
fantasy-check: $(OPSCTL_BIN)
|
||||||
@./scripts/sync-fantasy.sh --check
|
@$(OPSCTL) fantasy-check
|
||||||
|
|
||||||
## fantasy-diff: Show diff between vendored and upstream (optional FANTASY_VERSION=vX.Y.Z)
|
## fantasy-diff: Show diff between vendored and upstream (optional FANTASY_VERSION=vX.Y.Z)
|
||||||
fantasy-diff:
|
fantasy-diff: $(OPSCTL_BIN)
|
||||||
@./scripts/sync-fantasy.sh --diff $(FANTASY_VERSION)
|
@$(OPSCTL) fantasy-diff
|
||||||
|
|
||||||
## fantasy-sync: Full sync of vendored Fantasy SDK (optional FANTASY_VERSION=vX.Y.Z)
|
## fantasy-sync: Full sync of vendored Fantasy SDK (optional FANTASY_VERSION=vX.Y.Z)
|
||||||
fantasy-sync:
|
fantasy-sync: $(OPSCTL_BIN)
|
||||||
@./scripts/sync-fantasy.sh --sync $(FANTASY_VERSION)
|
@$(OPSCTL) fantasy-sync
|
||||||
|
|
||||||
## fantasy-patch: Save local modifications as a patch (requires NAME=description)
|
## fantasy-patch: Save local modifications as a patch (requires NAME=description)
|
||||||
fantasy-patch:
|
fantasy-patch: $(OPSCTL_BIN)
|
||||||
@./scripts/sync-fantasy.sh --save-patch $(NAME)
|
@$(OPSCTL) fantasy-patch
|
||||||
|
|
||||||
## test-integration: Run integration tests (requires build tags)
|
## test-integration: Run integration tests (requires build tags)
|
||||||
test-integration:
|
test-integration: $(OPSCTL_BIN)
|
||||||
@echo "Running integration tests..."
|
@$(OPSCTL) test-integration
|
||||||
@$(PIPELINE_GO) test -tags integration -count=1 -timeout 120s -v ./pkg/memory/...
|
|
||||||
@echo "Integration tests OK"
|
|
||||||
|
|
||||||
## check: Run vet, fmt, sqlc vet, and verify dependencies
|
## check: Run vet, fmt, sqlc vet, and verify dependencies
|
||||||
check: deps fmt vet sqlc-vet test
|
check: $(OPSCTL_BIN)
|
||||||
|
@$(OPSCTL) check
|
||||||
|
|
||||||
## run: Build and run dragonscale
|
## run: Build and run dragonscale
|
||||||
run: build
|
run: $(OPSCTL_BIN)
|
||||||
@$(BUILD_DIR)/$(BINARY_NAME) $(ARGS)
|
@$(OPSCTL) run $(ARGS)
|
||||||
|
|
||||||
## devcontainer-build: Build the local devcontainer image via npx devcontainer CLI
|
## devcontainer-build: Build the local devcontainer image via npx devcontainer CLI
|
||||||
devcontainer-build:
|
devcontainer-build: $(OPSCTL_BIN)
|
||||||
@npx --yes @devcontainers/cli build --workspace-folder .
|
@$(OPSCTL) devcontainer-build
|
||||||
|
|
||||||
## devcontainer-up: Start/update the local devcontainer via npx devcontainer CLI
|
## devcontainer-up: Start/update the local devcontainer via npx devcontainer CLI
|
||||||
devcontainer-up:
|
devcontainer-up: $(OPSCTL_BIN)
|
||||||
@npx --yes @devcontainers/cli up --workspace-folder .
|
@$(OPSCTL) devcontainer-up
|
||||||
|
|
||||||
## devcontainer-generate: Run go/sqlc/flatc generation inside devcontainer
|
## devcontainer-generate: Run go/sqlc/flatc generation inside devcontainer
|
||||||
devcontainer-generate:
|
devcontainer-generate: $(OPSCTL_BIN)
|
||||||
@npx --yes @devcontainers/cli exec --workspace-folder . -- bash -lc "go generate ./pkg/itr ./pkg/tools && sqlc generate -f pkg/memory/sqlc/sqlc.yaml"
|
@$(OPSCTL) devcontainer-generate
|
||||||
|
|
||||||
## devcontainer-verify: Validate generated code inside devcontainer
|
## devcontainer-verify: Validate generated code inside devcontainer
|
||||||
devcontainer-verify:
|
devcontainer-verify: $(OPSCTL_BIN)
|
||||||
@npx --yes @devcontainers/cli exec --workspace-folder . -- make flatc-check sqlc-check
|
@$(OPSCTL) devcontainer-verify
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Evaluation Harness
|
# Evaluation Harness
|
||||||
# Usage: make eval-build && make eval
|
|
||||||
# make eval-compare (A/B: branch vs main)
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
## eval-build: Build the eval runner from the current branch
|
## eval-build: Build the eval runner from the current branch
|
||||||
eval-build:
|
eval-build: $(OPSCTL_BIN)
|
||||||
@echo "Building eval runner..."
|
@$(OPSCTL) eval-build
|
||||||
@$(EVAL_GO) generate ./...
|
|
||||||
@mkdir -p eval/bin
|
|
||||||
@$(EVAL_GO) build $(GOFLAGS) $(LDFLAGS) -o eval/bin/eval-runner ./eval/cmd/eval-runner
|
|
||||||
@echo "Eval runner built: eval/bin/eval-runner"
|
|
||||||
|
|
||||||
## eval: Run the eval suite against the current build
|
## eval: Run the eval suite against the current build
|
||||||
eval: eval-build eval-fixtures
|
eval: $(OPSCTL_BIN)
|
||||||
@echo "Running eval suite..."
|
@$(OPSCTL) eval
|
||||||
@$(EVAL_BASH) 'cd eval && DRAGONSCALE_EVAL_CONFIG="./configs/default.json" $(EVAL_NPM) promptfoo eval --config promptfooconfig.yaml --no-cache --no-progress-bar'
|
|
||||||
@echo "Results: eval/results/latest.json"
|
|
||||||
@echo "View: cd eval && $(EVAL_NPM) promptfoo view"
|
|
||||||
|
|
||||||
## eval-fixtures: Reset workspace to a known state and seed fixture files for eval
|
## eval-fixtures: Reset workspace to a known state and seed fixture files for eval
|
||||||
## Uses XDG paths: ~/.local/share/dragonscale/sandbox/ and ~/.local/share/dragonscale/skills/
|
eval-fixtures: $(OPSCTL_BIN)
|
||||||
eval-fixtures:
|
@$(OPSCTL) eval-fixtures
|
||||||
@$(EVAL_BASH) '\
|
|
||||||
mkdir -p "$$HOME/.local/share/dragonscale/sandbox"; \
|
|
||||||
rm -f "$$HOME/.local/share/dragonscale/sandbox/eval_test_output.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/test_steps.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/eval_checkpoint.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/chain_test.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/current_year.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/result.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/progressive_test.txt" \
|
|
||||||
"$$HOME/.local/share/dragonscale/sandbox/os_name.txt"; \
|
|
||||||
rm -rf "$$HOME/.local/share/dragonscale/sandbox/project"; \
|
|
||||||
printf '"'"'dragonscale eval fixture — hello from the eval harness\nThis is line two of the fixture file.\n'"'"' > "$$HOME/.local/share/dragonscale/sandbox/eval_fixture.txt"; \
|
|
||||||
cp -f eval/fixtures/sample_data.txt "$$HOME/.local/share/dragonscale/sandbox/sample_data.txt"; \
|
|
||||||
mkdir -p "$$HOME/.local/share/dragonscale/skills"; \
|
|
||||||
cp -rf eval/fixtures/skills/* "$$HOME/.local/share/dragonscale/skills/" 2>/dev/null || true'
|
|
||||||
|
|
||||||
## eval-view: Open the promptfoo results viewer
|
## eval-view: Open the promptfoo results viewer
|
||||||
eval-view:
|
eval-view: $(OPSCTL_BIN)
|
||||||
@$(EVAL_BASH) 'cd eval && $(EVAL_NPM) promptfoo view'
|
@$(OPSCTL) eval-view
|
||||||
|
|
||||||
eval-clean:
|
eval-clean: $(OPSCTL_BIN)
|
||||||
@rm -rf eval/results
|
@$(OPSCTL) eval-clean
|
||||||
@rm -rf eval/bin
|
|
||||||
|
|
||||||
## eval-compare: A/B comparison of current branch vs main
|
## eval-compare: A/B comparison of current branch vs main
|
||||||
eval-compare:
|
eval-compare: $(OPSCTL_BIN)
|
||||||
@$(EVAL_BASH) 'cd eval && EVAL_NPM_CMD=$(EVAL_NPM) ./scripts/compare.sh --repeat 3'
|
@$(OPSCTL) eval-compare
|
||||||
|
|
||||||
## eval-test: Run Go-native component evals
|
## eval-test: Run Go-native component evals
|
||||||
eval-test:
|
eval-test: $(OPSCTL_BIN)
|
||||||
@echo "Running Go-native evals..."
|
@$(OPSCTL) eval-test
|
||||||
@$(EVAL_GO) test -v ./eval/go_evals/...
|
|
||||||
|
|
||||||
## help: Show this help message
|
## help: Show this help message
|
||||||
help:
|
help: $(OPSCTL_BIN)
|
||||||
@echo "dragonscale Makefile"
|
@$(OPSCTL) help
|
||||||
@echo ""
|
|
||||||
@echo "Usage:"
|
|
||||||
@echo " make [target]"
|
|
||||||
@echo ""
|
|
||||||
@echo "Targets:"
|
|
||||||
@grep -E '^## ' $(MAKEFILE_LIST) | sed 's/## / /'
|
|
||||||
@echo ""
|
|
||||||
@echo "Examples:"
|
|
||||||
@echo " make build # Build for current platform"
|
|
||||||
@echo " make install # Install to ~/.local/bin"
|
|
||||||
@echo " make uninstall # Remove from /usr/local/bin"
|
|
||||||
@echo " make install-skills # Install skills to workspace"
|
|
||||||
@echo ""
|
|
||||||
@echo "Environment Variables:"
|
|
||||||
@echo " DEVCONTAINER_EXEC # Override to force host or custom container command (set empty to disable)"
|
|
||||||
@echo " INSTALL_PREFIX # Installation prefix (default: ~/.local)"
|
|
||||||
@echo " WORKSPACE_DIR # Workspace directory (default: ~/.dragonscale/workspace)"
|
|
||||||
@echo " VERSION # Version string (default: git describe)"
|
|
||||||
@echo ""
|
|
||||||
@echo "Current Configuration:"
|
|
||||||
@echo " Platform: $(PLATFORM)/$(ARCH)"
|
|
||||||
@echo " Binary: $(BINARY_PATH)"
|
|
||||||
@echo " Install Prefix: $(INSTALL_PREFIX)"
|
|
||||||
@echo " Workspace: $(WORKSPACE_DIR)"
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,7 @@
|
||||||
"monitor_usb": true
|
"monitor_usb": true
|
||||||
},
|
},
|
||||||
"gateway": {
|
"gateway": {
|
||||||
"host": "0.0.0.0",
|
"host": "127.0.0.1",
|
||||||
"port": 18790
|
"port": 18790
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Reference in a new issue