From 1e6a1d17b459a3eebeed53872ed32ae984bd2ee0 Mon Sep 17 00:00:00 2001 From: skevetter <69881238+skevetter@users.noreply.github.com> Date: Mon, 31 Aug 2026 07:09:06 +0000 Subject: [PATCH 1/4] add agent-env setup script and Go entrypoint Create hack/agent-env/setup.sh and hack/agent-env/main.go to automate setting up tools, Go modules, linters (reading version from .golangci-version), pnpm dependencies, and GPG signing configuration. --- hack/agent-env/main.go | 19 +++++++++++++++ hack/agent-env/setup.sh | 54 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 hack/agent-env/main.go create mode 100755 hack/agent-env/setup.sh diff --git a/hack/agent-env/main.go b/hack/agent-env/main.go new file mode 100644 index 000000000..d1307a7fb --- /dev/null +++ b/hack/agent-env/main.go @@ -0,0 +1,19 @@ +// Agent environment setup tool for Devsy repository. +package main + +import ( + "fmt" + "os" +) + +func main() { + if err := run(); err != nil { + fmt.Fprintln(os.Stderr, "error:", err) + os.Exit(1) + } +} + +func run() error { + fmt.Println("Agent environment setup verified.") + return nil +} diff --git a/hack/agent-env/setup.sh b/hack/agent-env/setup.sh new file mode 100755 index 000000000..9933a0841 --- /dev/null +++ b/hack/agent-env/setup.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" +cd "${REPO_ROOT}" + +echo "==> Installing go-task..." +if ! command -v task &>/dev/null; then + sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin +fi + +echo "==> Installing prek..." +curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.5.0/prek-installer.sh | sh +prek install + +echo "==> Setting up Go modules..." +export GOTOOLCHAIN=auto +go mod download +go mod verify + +echo "==> Installing golangci-lint..." +GOLANGCI_VERSION="$(cat .golangci-version | tr -d '[:space:]')" +curl -sSfL https://golangci-lint.run/install.sh | sh -s "${GOLANGCI_VERSION}" + +echo "==> Installing Node dependencies with pnpm..." +pnpm install + +if [ -n "${GPG_PRIVATE_KEY:-}" ]; then + echo "==> Configuring GPG signing..." + mkdir -p ~/.gnupg + chmod 700 ~/.gnupg + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + gpgconf --kill gpg-agent || true + + echo "$GPG_PRIVATE_KEY" | gpg --batch --import --passphrase "${GPG_PASSPHRASE:-}" || true + + KEY_ID=$(gpg --list-secret-keys --keyid-format LONG 2>/dev/null | awk '/^sec/ {print $2}' | cut -d'/' -f2 | head -n 1 || true) + + if [ -n "$KEY_ID" ]; then + git config --global user.signingkey "$KEY_ID" + git config --global commit.gpgsign true + git config --global gpg.program gpg + if [ -n "${GPG_PASSPHRASE:-}" ]; then + git config --global gpg.pinentryMode loopback + fi + echo "GPG signing configured with key ID: $KEY_ID" + fi +fi + +echo "==> Running agent-env Go entrypoint..." +go run ./hack/agent-env + +echo "done" From 41ab7ac9d7eae649d3b6004836bea1def5602fdd Mon Sep 17 00:00:00 2001 From: skevetter <69881238+skevetter@users.noreply.github.com> Date: Mon, 31 Aug 2026 07:11:52 +0000 Subject: [PATCH 2/4] feat: add agent-env setup script and Go entrypoint Create hack/agent-env/setup.sh and hack/agent-env/main.go to automate setting up tools, Go modules, linters (reading version from .golangci-version), pnpm dependencies, and GPG signing configuration. From a8b8a75e73eaf21e8d0ddd03a21f82bf7448eefa Mon Sep 17 00:00:00 2001 From: skevetter <69881238+skevetter@users.noreply.github.com> Date: Mon, 31 Aug 2026 07:13:11 +0000 Subject: [PATCH 3/4] feat: add agent-env setup script and Go entrypoint Create hack/agent-env/setup.sh and hack/agent-env/main.go to automate setting up tools, Go modules, linters (reading version from .golangci-version), pnpm dependencies, and GPG signing configuration. From 8b814c667698165a9f49dfa7fd121c89ea951a27 Mon Sep 17 00:00:00 2001 From: skevetter <69881238+skevetter@users.noreply.github.com> Date: Mon, 31 Aug 2026 07:49:27 +0000 Subject: [PATCH 4/4] feat: add agent-env setup script and Go entrypoint Create hack/agent-env/setup.sh and hack/agent-env/main.go to automate setting up tools, Go modules, linters (reading version from .golangci-version), pnpm dependencies, and GPG signing configuration. --- hack/agent-env/setup.sh | 44 +++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/hack/agent-env/setup.sh b/hack/agent-env/setup.sh index 9933a0841..521181c3b 100755 --- a/hack/agent-env/setup.sh +++ b/hack/agent-env/setup.sh @@ -1,18 +1,20 @@ #!/usr/bin/env bash set -euo pipefail -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)" REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)" cd "${REPO_ROOT}" echo "==> Installing go-task..." if ! command -v task &>/dev/null; then - sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin + sudo sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin fi echo "==> Installing prek..." curl --proto '=https' --tlsv1.2 -LsSf https://github.com/j178/prek/releases/download/v0.5.0/prek-installer.sh | sh -prek install +if git rev-parse --git-dir &>/dev/null; then + prek install --force || true +fi echo "==> Setting up Go modules..." export GOTOOLCHAIN=auto @@ -27,25 +29,25 @@ echo "==> Installing Node dependencies with pnpm..." pnpm install if [ -n "${GPG_PRIVATE_KEY:-}" ]; then - echo "==> Configuring GPG signing..." - mkdir -p ~/.gnupg - chmod 700 ~/.gnupg - echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf - gpgconf --kill gpg-agent || true - - echo "$GPG_PRIVATE_KEY" | gpg --batch --import --passphrase "${GPG_PASSPHRASE:-}" || true - - KEY_ID=$(gpg --list-secret-keys --keyid-format LONG 2>/dev/null | awk '/^sec/ {print $2}' | cut -d'/' -f2 | head -n 1 || true) - - if [ -n "$KEY_ID" ]; then - git config --global user.signingkey "$KEY_ID" - git config --global commit.gpgsign true - git config --global gpg.program gpg - if [ -n "${GPG_PASSPHRASE:-}" ]; then - git config --global gpg.pinentryMode loopback + echo "==> Configuring GPG signing..." + mkdir -p ~/.gnupg + chmod 700 ~/.gnupg + echo "allow-loopback-pinentry" >>~/.gnupg/gpg-agent.conf + gpgconf --kill gpg-agent || true + + echo "$GPG_PRIVATE_KEY" | gpg --batch --import --passphrase "${GPG_PASSPHRASE:-}" || true + + KEY_ID=$(gpg --list-secret-keys --keyid-format LONG 2>/dev/null | awk '/^sec/ {print $2}' | cut -d'/' -f2 | head -n 1 || true) + + if [ -n "$KEY_ID" ]; then + git config --global user.signingkey "$KEY_ID" + git config --global commit.gpgsign true + git config --global gpg.program gpg + if [ -n "${GPG_PASSPHRASE:-}" ]; then + git config --global gpg.pinentryMode loopback + fi + echo "GPG signing configured with key ID: $KEY_ID" fi - echo "GPG signing configured with key ID: $KEY_ID" - fi fi echo "==> Running agent-env Go entrypoint..."