diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 68d8ab7..0000000 --- a/.dockerignore +++ /dev/null @@ -1,12 +0,0 @@ -.git -.github -.gitignore -*.md -.env -.env.* -Dockerfile -.dockerignore -coverage.out -docs/ -deploy/ -api/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49401df..6625265 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -166,7 +166,7 @@ jobs: run: git clone --depth=1 https://github.com/GrayCodeAI/tok.git ../tok - name: deadcode run: | - go install golang.org/x/tools/cmd/deadcode@latest + go install golang.org/x/tools/cmd/deadcode@v0.30.0 deadcode ./... 2>&1 | head -50 # ------------------------------------------------------------------------- diff --git a/CHANGELOG.md b/CHANGELOG.md index c188a1e..187d6b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,10 +10,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - **Version re-baselined to `0.1.0`** across `internal/server/mcp.go` (advertised MCP server version), `sdk/python/pyproject.toml`, - `sdk/typescript/package.json`, `Formula/yaad.rb` (formula `version` - + every release-asset URL), and `openapi.yaml` (header `version` and - the `/yaad/health` example). Aligns yaad with the rest of the + `sdk/typescript/package.json`, and `api/openapi.yaml` (header `version` + and the `/yaad/health` example). Aligns yaad with the rest of the hawk-eco ecosystem (`hawk`, `tok`, `eyrie`, `sight`, `inspect`). +- **`internal/version`**: `Version` is now read at compile time via + `go:embed` from `internal/version/VERSION` (kept in sync with the root + `VERSION` via `make sync-version`). Previously hard-coded to `"dev"` + and only overrideable through ldflags that no build path was actually + setting — so every build reported `dev` regardless of the VERSION + file. Pure `go build` / `go install` / `go get` now report the + correct version with zero ldflags wiring required. + +### Removed +- **`install.sh`** — fetched `yaad_${OS}_${ARCH}` from GitHub Releases and + ran `yaad auto`. yaad is library-only (no `cmd/`, no `package main`, no + goreleaser config); there is no such binary or subcommand. +- **`Formula/yaad.rb`** — Homebrew formula pointed at + `releases/download/v0.2.0/yaad__` artifacts that have never + been published, ran `yaad --version` against a binary that does not + exist, and was still pinned at `0.2.0` while the rest of the repo + re-baselined to `0.1.0`. Will return once a binary actually ships. +- **`deploy/docker/docker-compose.yml`** + **`.dockerignore`** — + referenced a `Dockerfile` that does not exist in the repo. yaad is a + library; consumers wire `internal/server/RESTServer` into their own + daemons (or use `hawk daemon`). ### Security - **Stop tracking `.yaad/integrity.key`** — this is a per-installation diff --git a/Formula/yaad.rb b/Formula/yaad.rb deleted file mode 100644 index 267b26a..0000000 --- a/Formula/yaad.rb +++ /dev/null @@ -1,36 +0,0 @@ -class Yaad < Formula - desc "Model-agnostic, graph-native memory for coding agents" - homepage "https://github.com/GrayCodeAI/yaad" - version "0.2.0" # x-release-please-version - license "MIT" - - on_macos do - on_arm do - url "https://github.com/GrayCodeAI/yaad/releases/download/v0.2.0/yaad_darwin_arm64" # x-release-please-version - sha256 "" # filled on release - end - on_intel do - url "https://github.com/GrayCodeAI/yaad/releases/download/v0.2.0/yaad_darwin_amd64" # x-release-please-version - sha256 "" # filled on release - end - end - - on_linux do - on_arm do - url "https://github.com/GrayCodeAI/yaad/releases/download/v0.2.0/yaad_linux_arm64" # x-release-please-version - sha256 "" # filled on release - end - on_intel do - url "https://github.com/GrayCodeAI/yaad/releases/download/v0.2.0/yaad_linux_amd64" # x-release-please-version - sha256 "" # filled on release - end - end - - def install - bin.install "yaad_#{OS.mac? ? "darwin" : "linux"}_#{Hardware::CPU.arm? ? "arm64" : "amd64"}" => "yaad" - end - - test do - system "#{bin}/yaad", "--version" - end -end diff --git a/Makefile b/Makefile index 0a3af4f..328d421 100644 --- a/Makefile +++ b/Makefile @@ -8,9 +8,12 @@ NAME := yaad # --------------------------------------------------------------------------- # Versioning — sourced from VERSION file; falls back to git describe. -# See https://github.com/GrayCodeAI/hawk/blob/main/VERSIONING.md. +# See https://github.com/GrayCodeAI/hawk/blob/main/docs/versioning.md. # yaad is library-only: it ships no binary, so there is no goreleaser config -# and no ldflags to inject. VERSION is exposed only via `make version`. +# and no ldflags to inject the version. The runtime `version.Version` +# constant is read at compile time via `go:embed` from +# `internal/version/VERSION` (kept in sync with the root VERSION via +# `make sync-version`). `make version` just echoes what `go:embed` will see. # --------------------------------------------------------------------------- VERSION ?= $(shell cat VERSION 2>/dev/null | head -n1 | tr -d '[:space:]' || git describe --tags --always --dirty 2>/dev/null || echo "dev") COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "none") @@ -29,7 +32,7 @@ GOVULNCHECK := $(GOBIN_DIR)/govulncheck # Phony declarations (alphabetical). # --------------------------------------------------------------------------- .PHONY: all bench build ci clean cover fmt help lint lint-fix \ - security test test-10x test-race tidy version vet + security sync-version test test-10x test-race tidy version vet # --------------------------------------------------------------------------- # Default target. @@ -91,6 +94,10 @@ tidy: ## Tidy go.mod / go.sum. go mod tidy go mod verify +sync-version: ## Copy root VERSION into internal/version/VERSION (kept in sync for go:embed). + @cp VERSION internal/version/VERSION + @echo "internal/version/VERSION updated to $$(cat VERSION)" + # --------------------------------------------------------------------------- # Composite gate used by CI and pre-push. # --------------------------------------------------------------------------- diff --git a/deploy/docker/docker-compose.yml b/deploy/docker/docker-compose.yml deleted file mode 100644 index 58634b1..0000000 --- a/deploy/docker/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: yaad - -services: - yaad: - build: - context: ../../ - dockerfile: Dockerfile - image: ghcr.io/graycodeai/yaad:dev - ports: - - "3456:3456" - environment: - - YAAD_API_KEY=${YAAD_API_KEY:-} - - YAAD_DATA_DIR=/data - volumes: - - yaad-data:/data - -volumes: - yaad-data: diff --git a/install.sh b/install.sh deleted file mode 100644 index 25c979c..0000000 --- a/install.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env sh -# Yaad installer — curl -fsSL https://raw.githubusercontent.com/GrayCodeAI/yaad/main/install.sh | sh -set -e - -REPO="GrayCodeAI/yaad" -BINARY="yaad" -INSTALL_DIR="${YAAD_INSTALL_DIR:-/usr/local/bin}" - -# Detect OS and arch -OS=$(uname -s | tr '[:upper:]' '[:lower:]') -ARCH=$(uname -m) -case "$ARCH" in - x86_64) ARCH="amd64" ;; - aarch64|arm64) ARCH="arm64" ;; - *) echo "Unsupported architecture: $ARCH"; exit 1 ;; -esac - -# Get latest release tag -echo "Fetching latest Yaad release..." -TAG=$(curl -fsSL "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | sed 's/.*"tag_name": *"\([^"]*\)".*/\1/') -if [ -z "$TAG" ]; then - echo "Could not determine latest release. Install manually from:" - echo " https://github.com/${REPO}/releases" - exit 1 -fi - -FILENAME="${BINARY}_${OS}_${ARCH}" -URL="https://github.com/${REPO}/releases/download/${TAG}/${FILENAME}" - -echo "Installing yaad ${TAG} (${OS}/${ARCH})..." -curl -fsSL "$URL" -o "/tmp/${BINARY}" -chmod +x "/tmp/${BINARY}" - -# Install (try with sudo if needed) -if [ -w "$INSTALL_DIR" ]; then - mv "/tmp/${BINARY}" "${INSTALL_DIR}/${BINARY}" -else - echo "Installing to ${INSTALL_DIR} (requires sudo)..." - sudo mv "/tmp/${BINARY}" "${INSTALL_DIR}/${BINARY}" -fi - -echo "" -echo "✓ yaad ${TAG} installed to ${INSTALL_DIR}/${BINARY}" -echo "" - -# Auto-setup if we're in a project directory -if [ -d ".git" ] || [ -f "package.json" ] || [ -f "go.mod" ] || [ -f "Cargo.toml" ] || [ -f "pyproject.toml" ]; then - echo "Detected project directory. Running auto-setup..." - echo "" - "${INSTALL_DIR}/${BINARY}" auto -else - echo "Quick start:" - echo " cd your-project && yaad" - echo "" - echo "That's it. Yaad auto-detects your agent and configures everything." - echo "" - echo "Docs: https://github.com/${REPO}" -fi diff --git a/internal/version/VERSION b/internal/version/VERSION new file mode 100644 index 0000000..6e8bf73 --- /dev/null +++ b/internal/version/VERSION @@ -0,0 +1 @@ +0.1.0 diff --git a/internal/version/version.go b/internal/version/version.go index 646c5b9..1a6ae42 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -1,34 +1,43 @@ -// Package version provides the canonical version string for the yaad binary. +// Package version provides the canonical version string for yaad. // -// Single source of truth: the VERSION file at the repo root. To bump the -// version, edit that one file. Both build paths read it and inject these vars -// at build time via ldflags (the package path and var names below must match -// in all callers — Makefile and .goreleaser.yml): +// Single source of truth: the VERSION file at the repo root, which is +// kept in sync with the co-located internal/version/VERSION via the +// `make tidy` target (or `release-please`, which bumps both atomically). // -// go build -ldflags " \ -// -X github.com/GrayCodeAI/yaad/internal/version.Version=$(cat VERSION) \ -// -X github.com/GrayCodeAI/yaad/internal/version.Commit=$(git rev-parse --short HEAD) \ -// -X github.com/GrayCodeAI/yaad/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" +// The co-located VERSION file is embedded at compile time via `go:embed`, +// so `go build`, `go install`, and `go get` all see the correct version +// with zero ldflags wiring required. Release builds (goreleaser, or +// `make build` if a binary is ever added) may additionally inject a +// short commit + build date through ldflags: // -// - `make build` reads VERSION (see the Makefile's VERSION/LDFLAGS). -// - Goreleaser injects {{.Version}} from the git tag during release builds. +// go build -ldflags " \ +// -X github.com/GrayCodeAI/yaad/internal/version.Commit=$(git rev-parse --short HEAD) \ +// -X github.com/GrayCodeAI/yaad/internal/version.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)" // -// The defaults below ("dev", "none", "unknown") apply only to local builds -// without ldflags so a fresh `go build` still produces a runnable binary. +// Do NOT edit Version directly — bump the root VERSION file and resync +// the co-located one (or let release-please/goreleaser do it). package version import ( + _ "embed" "fmt" "runtime" + "strings" ) -// Version is the current version of yaad. Set via ldflags at release time. -var Version = "dev" +//go:embed VERSION +var versionFile string -// Commit is the git commit short SHA. Set via ldflags at release time. +// Version is the current version of yaad, embedded from the VERSION file +// at compile time. +var Version = strings.TrimSpace(versionFile) + +// Commit is the git commit short SHA. Set via ldflags at release time; +// defaults to "none" for plain `go build`. var Commit = "none" -// Date is the build date in RFC3339. Set via ldflags at release time. +// Date is the build date in RFC3339. Set via ldflags at release time; +// defaults to "unknown" for plain `go build`. var Date = "unknown" // String returns just the version string (kept for backwards compatibility