Merge pull request 'Prepare for GitHub migration' (#33) from benvin/github-migration into main
ci / release-snapshot (push) Failing after 11m30s
ci / go (push) Failing after 11m30s
ci / actions (push) Failing after 11m31s
ci / ci (push) Failing after 11m32s
ci / goreleaser-check (push) Has been cancelled

Reviewed-on: #33
This commit was merged in pull request #33.
This commit is contained in:
2026-11-27 22:35:33 +11:00
27 changed files with 299 additions and 444 deletions
+1
View File
@@ -0,0 +1 @@
* @IUCLabs/maintainers
+2
View File
@@ -0,0 +1,2 @@
self-hosted-runner:
labels: [iuclabs-k8s]
+62
View File
@@ -0,0 +1,62 @@
name: ci
on:
pull_request:
push:
branches: [main]
permissions: {}
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
ci:
uses: IUCLabs/workflows/.github/workflows/pre-commit.yml@v0.1.1
permissions:
contents: read
with:
go_version_file: go.mod
runs_on: iuclabs-k8s
actions:
uses: IUCLabs/workflows/.github/workflows/actions.yml@v0.1.1
permissions:
contents: read
with:
runs_on: ubuntu-latest
go:
uses: IUCLabs/workflows/.github/workflows/go-ci.yml@v0.1.1
permissions:
contents: read
pull-requests: read
with:
runs_on: iuclabs-k8s
release-snapshot:
uses: IUCLabs/workflows/.github/workflows/release-goreleaser.yml@v0.1.1
# the called job declares the release permissions; snapshot skips Vault, signing and publishing
permissions:
contents: write
id-token: write
packages: write
with:
image: false
snapshot: true
runs_on: iuclabs-k8s
goreleaser-check:
runs-on: iuclabs-k8s
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: goreleaser/goreleaser-action@a4f02ab5355a589de60d917a659ce617ed19b3de # v7.3.0
with:
distribution: goreleaser
version: v2.20.2
args: check
+18
View File
@@ -0,0 +1,18 @@
name: release
on:
push:
tags: ["v*"]
permissions: {}
jobs:
release:
uses: IUCLabs/workflows/.github/workflows/release-goreleaser.yml@v0.1.1
permissions:
contents: write
id-token: write
packages: write
with:
image: false
vault_role: release-shared
+11
View File
@@ -0,0 +1,11 @@
rules:
unpinned-uses:
config:
policies:
# shared workflows are pinned to their release tags
"IUCLabs/*": ref-pin
"*": hash-pin
archived-uses:
ignore:
# dnephin/pre-commit-golang is archived but its hooks still work
- .pre-commit-config.yaml
+4 -4
View File
@@ -2,8 +2,8 @@
/agentpr
/watchpr
/agentws
# cross-compiled release artifacts (e.g. agentpr-linux-amd64)
/agentpr-*
/watchpr-*
/agentws-*
/agentvault
/agentreview
/agentgh
dist/
/completions/
+119
View File
@@ -0,0 +1,119 @@
version: 2
project_name: agent-tools
before:
hooks:
- scripts/completions.sh
# Each tool has a linux/amd64 build (the only one packaged into the RPM) and an
# "-other" build for the remaining platforms.
builds:
- &build
id: agentpr
main: ./cmd/agentpr
binary: agentpr
env:
- CGO_ENABLED=0
mod_timestamp: "{{ .CommitTimestamp }}"
flags:
- -trimpath
ldflags:
- -s -w -X main.version={{ .Tag }}
goos: [linux]
goarch: [amd64]
- &other
<<: *build
id: agentpr-other
goos: [linux, darwin]
goarch: [amd64, arm64]
ignore:
- goos: linux
goarch: amd64
- <<: *build
id: watchpr
main: ./cmd/watchpr
binary: watchpr
- <<: *other
id: watchpr-other
main: ./cmd/watchpr
binary: watchpr
- <<: *build
id: agentws
main: ./cmd/agentws
binary: agentws
- <<: *other
id: agentws-other
main: ./cmd/agentws
binary: agentws
- <<: *build
id: agentvault
main: ./cmd/agentvault
binary: agentvault
- <<: *other
id: agentvault-other
main: ./cmd/agentvault
binary: agentvault
- <<: *build
id: agentreview
main: ./cmd/agentreview
binary: agentreview
- <<: *other
id: agentreview-other
main: ./cmd/agentreview
binary: agentreview
- <<: *build
id: agentgh
main: ./cmd/agentgh
binary: agentgh
- <<: *other
id: agentgh-other
main: ./cmd/agentgh
binary: agentgh
archives:
- formats: [binary]
name_template: "{{ .Binary }}-{{ .Os }}-{{ .Arch }}"
nfpms:
- package_name: agent-tools
ids: [agentpr, watchpr, agentws, agentvault, agentreview, agentgh]
formats: [rpm]
file_name_template: "{{ .ConventionalFileName }}"
release: "1"
section: default
maintainer: Ben Vincent <12552114+neoloc@users.noreply.github.com>
homepage: https://github.com/IUCLabs/agent-tools
license: MIT
description: "CLI tools for automation as an agent user: agentpr (create PRs/comments), watchpr (poll PRs and alert on meaningful change), agentws (manage per-branch git worktrees), agentvault (deterministic Vault flows), agentreview (GitHub webhook PR reviewer) and agentgh (gh/git as a GitHub App)"
bindir: /usr/bin
replaces: [agent-tools]
provides: [agent-tools]
contents:
- src: completions/bash/*
dst: /usr/share/bash-completion/completions/
file_info:
mode: 0644
- src: completions/zsh/*
dst: /usr/share/zsh/site-functions/
file_info:
mode: 0644
- src: completions/fish/*
dst: /usr/share/fish/vendor_completions.d/
file_info:
mode: 0644
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
signs:
- artifacts: checksum
cmd: scripts/sign.sh
args: ["${artifact}", "${signature}"]
release:
use_existing_draft: true
mode: keep-existing
changelog:
disable: true
-182
View File
@@ -1,182 +0,0 @@
when:
- event: tag
steps:
- name: test
image: "artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:0.1.2-alma9"
environment:
GOCACHE_S3_BUCKET: gocache
GOCACHE_S3_REGION: us-east-1
GOCACHE_S3_ENDPOINT_URL: "https://s3.ceph.unkin.net"
GOCACHE_S3_PATH_STYLE: "true"
GOCACHE_KEY_PREFIX: ci-agent-tools
GOCACHEPROG: go-cache-plugin --cache-dir=/tmp/gocache
AWS_ACCESS_KEY_ID:
from_secret: GOCACHE_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: GOCACHE_AWS_SECRET_ACCESS_KEY
commands:
- go test -race ./...
backend_options:
kubernetes:
serviceAccountName: default
resources:
requests:
memory: 512Mi
cpu: 1
limits:
memory: 2Gi
cpu: 2
# Build every binary into dist/ (consumed by the RPM step) plus the
# cross-platform binaries attached to the Gitea release. Each tool is a
# separate main package, so they are built individually per os/arch.
- name: build
image: "artifactapi.k8s.syd1.au.unkin.net/docker-internal/gobuilder:0.1.2-alma9"
environment:
GOCACHE_S3_BUCKET: gocache
GOCACHE_S3_REGION: us-east-1
GOCACHE_S3_ENDPOINT_URL: "https://s3.ceph.unkin.net"
GOCACHE_S3_PATH_STYLE: "true"
GOCACHE_KEY_PREFIX: ci-agent-tools
GOCACHEPROG: go-cache-plugin --cache-dir=/tmp/gocache
AWS_ACCESS_KEY_ID:
from_secret: GOCACHE_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: GOCACHE_AWS_SECRET_ACCESS_KEY
commands:
- make build VERSION=${CI_COMMIT_TAG}
# Shell variables/expansions are escaped as $$ so Woodpecker leaves them
# for the shell instead of substituting them (as pipeline vars) at parse
# time. ${CI_COMMIT_TAG} is a real Woodpecker var and stays single-$.
- |
for entry in "agentpr:./cmd/agentpr" "watchpr:./cmd/watchpr" "agentws:./cmd/agentws" "agentvault:./cmd/agentvault" "agentreview:./cmd/agentreview"; do
name="$${entry%%:*}"; pkg="$${entry##*:}"
for osarch in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64; do
os="$${osarch%/*}"; arch="$${osarch#*/}"
GOOS="$$os" GOARCH="$$arch" \
go build -ldflags="-s -w -X main.version=${CI_COMMIT_TAG}" \
-o "$${name}-$${os}-$${arch}" "$$pkg"
done
done
depends_on: [test]
backend_options:
kubernetes:
serviceAccountName: default
resources:
requests:
memory: 512Mi
cpu: 1
limits:
memory: 2Gi
cpu: 2
# Package the built binaries + generated shell completions into an RPM.
- name: package
image: artifactapi.k8s.syd1.au.unkin.net/docker-internal/rpmbuilder:0.1.0-alma9
commands:
- ./scripts/build-rpm.sh ${CI_COMMIT_TAG}
depends_on: [build]
backend_options:
kubernetes:
serviceAccountName: default
resources:
requests:
memory: 512Mi
cpu: 1
limits:
memory: 2Gi
cpu: 2
# Publish the RPM to the artifactapi local rpm repo (a real yum repo;
# repodata regenerates automatically).
- name: upload-rpm
image: git.unkin.net/unkin/almalinux9-base:20260606
commands:
- |
HOST="https://artifactapi.k8s.syd1.au.unkin.net"
REPO="rpm-internal"
set -o pipefail
VAULT="https://vault.service.consul:8200"
AUTH=$$(mktemp)
VT=$$(jq -n --rawfile jwt /var/run/secrets/kubernetes.io/serviceaccount/token '{role:"woodpecker_artifactapi_writer",jwt:$$jwt}' \
| curl -sf -d @- "$$VAULT/v1/auth/k8s/au/syd1/login" | jq -er .auth.client_token) || exit 1
printf 'X-Vault-Token: %s\n' "$$VT" | curl -sf -H @- "$$VAULT/v1/identity/oidc/token/artifactapi-writer" \
| jq -er '"Authorization: Bearer " + .data.token' > "$$AUTH" || exit 1
for rpm in dist/*.rpm; do
FILE=$$(basename "$$rpm")
# artifactapi has no HEAD route (returns 405); probe with GET against
# the served path (RPMs are stored under Packages/) to avoid re-upload.
code=$$(curl -s -o /dev/null -w '%{http_code}' "$$HOST/api/v2/remotes/$$REPO/files/Packages/$$FILE" || true)
if [ "$$code" = "200" ]; then
echo "$$FILE already exists in $$REPO (HTTP $$code); skipping upload"
continue
fi
echo "Uploading $$FILE to $$REPO (existence probe returned $$code)"
curl -f -X PUT \
"$$HOST/api/v2/remotes/$$REPO/files/$$FILE" \
-H "Content-Type: application/x-rpm" -H @"$$AUTH" \
--data-binary @"$$rpm"
done
depends_on: [package]
backend_options:
kubernetes:
serviceAccountName: default
resources:
requests:
memory: 128Mi
cpu: 100m
limits:
memory: 512Mi
cpu: 500m
# Cut a Gitea release with the cross-platform binaries attached.
- name: release
image: git.unkin.net/unkin/almalinux9-base:20260606
environment:
RELEASER_TOKEN:
from_secret: RELEASER_TOKEN
commands:
- |
curl --output /usr/local/bin/tea https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/gitea-dl/tea/0.12.0/tea-0.12.0-linux-amd64 && chmod +x /usr/local/bin/tea
tea logins add --name gitea --url https://git.unkin.net --token "$${RELEASER_TOKEN}" --no-version-check
# $$ escapes shell vars/substitutions so Woodpecker doesn't blank them
# at parse time; ${CI_COMMIT_TAG}/${CI_REPO} are real Woodpecker vars.
# Find the previous release tag for the changelog range. Several tags can
# point at the same commit, so we skip tags on the current commit and
# pick the newest semver tag that is a real ancestor of this one.
CUR_SHA=$$(git rev-list -n1 "${CI_COMMIT_TAG}")
PREV_TAG=""
for t in $$(git tag --sort=-v:refname); do
[ "$$t" = "${CI_COMMIT_TAG}" ] && continue
[ "$$(git rev-list -n1 "$$t")" = "$$CUR_SHA" ] && continue
if git merge-base --is-ancestor "$$t" "${CI_COMMIT_TAG}" 2>/dev/null; then
PREV_TAG="$$t"; break
fi
done
if [ -n "$$PREV_TAG" ]; then
NOTES=$$(git log "$${PREV_TAG}..${CI_COMMIT_TAG}" --pretty=format:"- %s")
else
NOTES=$$(git log --pretty=format:"- %s")
fi
tea releases create --tag "${CI_COMMIT_TAG}" --title "${CI_COMMIT_TAG}" --note "$${NOTES}" --login gitea --repo "${CI_REPO}"
# The build step writes the cross-compiled binaries into the workspace
# root; the package step writes the RPM to dist/. Generate a checksums
# manifest over everything we attach so downloads can be verified.
RPM=$$(ls dist/*.rpm 2>/dev/null | head -1)
ASSETS="agentpr-linux-amd64 agentpr-linux-arm64 agentpr-darwin-amd64 agentpr-darwin-arm64 watchpr-linux-amd64 watchpr-linux-arm64 watchpr-darwin-amd64 watchpr-darwin-arm64 agentws-linux-amd64 agentws-linux-arm64 agentws-darwin-amd64 agentws-darwin-arm64 agentvault-linux-amd64 agentvault-linux-arm64 agentvault-darwin-amd64 agentvault-darwin-arm64 agentreview-linux-amd64 agentreview-linux-arm64 agentreview-darwin-amd64 agentreview-darwin-arm64"
[ -n "$$RPM" ] && ASSETS="$$ASSETS $$RPM"
sha256sum $$ASSETS > sha256sums.txt
tea releases assets create "${CI_COMMIT_TAG}" $$ASSETS sha256sums.txt \
--login gitea --repo "${CI_REPO}"
depends_on: [upload-rpm]
backend_options:
kubernetes:
serviceAccountName: default
resources:
requests:
memory: 128Mi
cpu: 100m
limits:
memory: 512Mi
cpu: 500m
+18 -14
View File
@@ -59,12 +59,14 @@ internal/agent/ # shared plumbing:
seedoauth.go # seed-oauth flow (oauth2-proxy credential set in Vault KV)
github.go # GitHub App: KV creds, RS256 JWT (stdlib), installation token, bot identity
githubpr.go # GitHub PR state for watchpr (status + check-runs merge, comment filter)
go.mod # module git.unkin.net/unkin/agent-tools
Makefile # build / test / lint / completions / rpm / version-bump
packaging/nfpm.yaml # nfpm spec (envsubst-templated) for the RPM (all binaries)
scripts/build-rpm.sh # generates completions + packages the RPM with nfpm
.woodpecker/ # CI: build, test, pre-commit (PR) + release (tag)
dist/ # build output: binaries, completions, RPM (not committed)
go.mod # module github.com/IUCLabs/agent-tools
Makefile # build / test / lint / completions / rpm (snapshot) / version-bump
.goreleaser.yaml # binaries, RPM (all binaries + completions), signed checksums
scripts/completions.sh # generates bash/zsh/fish completions into completions/
scripts/sign.sh # signs the release checksums via the Vault gpg engine
.github/workflows/ # CI (pre-commit, actions, go, goreleaser) + release (tag)
.woodpecker/ # PR checks: build, test, pre-commit
dist/ # build output: binaries, RPM (not committed)
```
Every binary is a separate `main` package, so `make build` builds each with its
@@ -124,15 +126,17 @@ Requires Go 1.21+. Dependency: `github.com/spf13/cobra` (CLI).
## Packaging (RPM)
```bash
make rpm # build all binaries + package into dist/*.rpm via nfpm
make rpm # goreleaser snapshot: binaries + dist/*.rpm, unsigned
```
`scripts/build-rpm.sh` generates bash/zsh/fish completions from the built
binaries and bundles them alongside `/usr/bin/agentpr`, `/usr/bin/watchpr`,
`/usr/bin/agentws`, `/usr/bin/agentvault`, `/usr/bin/agentreview` and
`/usr/bin/agentgh`.
On a `v*` tag the release pipeline builds the RPM and `PUT`s it to the
artifactapi `rpm-internal` repo, then cuts a Gitea release.
goreleaser's `before` hook runs `scripts/completions.sh` to generate
bash/zsh/fish completions, and the RPM bundles them alongside
`/usr/bin/agentpr`, `/usr/bin/watchpr`, `/usr/bin/agentws`,
`/usr/bin/agentvault`, `/usr/bin/agentreview` and `/usr/bin/agentgh`.
`make patch|minor|major` drafts a GitHub release and pushes the tag; the
release workflow then runs goreleaser, which attaches the binaries, RPM and
signed checksums to the draft and publishes it at
https://github.com/IUCLabs/agent-tools/releases.
## Shell completions
@@ -144,7 +148,7 @@ paths (`/usr/share/bash-completion/completions/`,
## Testing
```bash
make test # go test -v -race ./...
make test # go test -v ./...
```
`internal/agent` covers PR-ref parsing, the `MeaningfulChange` table (benign vs
+27 -41
View File
@@ -11,13 +11,12 @@ ARCH ?= $(shell go env GOARCH)
# shell for-loop over $(BINARIES).
pkgpath = ./cmd/$$b
.PHONY: all build test lint pre-commit fmt clean install completions rpm rpm-package patch minor major _tag
.PHONY: all build test lint pre-commit fmt clean install completions rpm patch minor major
all: build
# Build every binary into dist/ so the nfpm packaging step
# (scripts/build-rpm.sh) can find them. Each main package needs its own -o, so
# they are built individually rather than with a single ./... invocation.
# Each main package needs its own -o, so they are built individually rather
# than with a single ./... invocation.
build:
@for b in $(BINARIES); do \
echo "building $$b"; \
@@ -25,7 +24,7 @@ build:
done
test:
go test -v -race ./...
go test -v ./...
lint:
golangci-lint run ./...
@@ -37,46 +36,33 @@ fmt:
gofmt -w .
clean:
rm -rf $(DIST) $(BINARIES)
rm -rf $(DIST) $(BINARIES) completions
install:
go install $(GOFLAGS) ./...
# Generate bash/zsh/fish completions for every binary into dist/completions.
completions: build
@mkdir -p $(DIST)/completions
@for b in $(BINARIES); do \
$(DIST)/$$b completion bash > $(DIST)/completions/$$b.bash; \
$(DIST)/$$b completion zsh > $(DIST)/completions/_$$b; \
$(DIST)/$$b completion fish > $(DIST)/completions/$$b.fish; \
done
# Generate bash/zsh/fish completions for every binary into completions/.
completions:
./scripts/completions.sh
# Build the binaries then package them (with completions) into an RPM via nfpm.
rpm: build rpm-package
# Snapshot release: raw binaries plus the RPM in dist/, unsigned.
rpm:
GOTOOLCHAIN=auto go run github.com/goreleaser/goreleaser/v2@v2.20.2 release --snapshot --clean --skip=sign
# Package already-built binaries into an RPM (used by CI after the build step).
rpm-package:
./scripts/build-rpm.sh $(VERSION)
DEFAULT_BRANCH ?= main
# Bump helpers — reads the latest semver tag and creates the next one.
# If no tag exists yet, starts from v0.0.0.
_LATEST := $(shell git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' | head -1)
_BASE := $(if $(_LATEST),$(_LATEST),v0.0.0)
_MAJ := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f1)
_MIN := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f2)
_PAT := $(shell echo $(_BASE) | sed 's/^v//' | cut -d. -f3)
patch:
@NEW=v$(_MAJ).$(_MIN).$(shell expr $(_PAT) + 1); \
git tag $$NEW && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
minor:
@NEW=v$(_MAJ).$(shell expr $(_MIN) + 1).0; \
git tag $$NEW && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
major:
@NEW=v$(shell expr $(_MAJ) + 1).0.0; \
git tag $$NEW && echo "Tagged $$NEW" && $(MAKE) _tag TAG=$$NEW
_tag:
git push origin $(TAG)
# Draft the release with generated notes, then push the tag; the release
# workflow attaches assets to the draft and publishes it.
patch minor major:
@git fetch --quiet --tags origin $(DEFAULT_BRANCH)
@test "$$(git branch --show-current)" = "$(DEFAULT_BRANCH)" || { echo "ERROR: not on $(DEFAULT_BRANCH)"; exit 1; }
@test -z "$$(git status --porcelain)" || { echo "ERROR: working tree not clean"; exit 1; }
@test "$$(git rev-parse HEAD)" = "$$(git rev-parse origin/$(DEFAULT_BRANCH))" || { echo "ERROR: HEAD is not origin/$(DEFAULT_BRANCH)"; exit 1; }
@LATEST=$$(git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$$' | head -1); \
NEW=$$(echo "$${LATEST:-v0.0.0}" | sed 's/^v//' | awk -F. -v b=$@ '{ \
if (b == "major") print "v" ($$1+1) ".0.0"; \
else if (b == "minor") print "v" $$1 "." ($$2+1) ".0"; \
else print "v" $$1 "." $$2 "." ($$3+1) }'); \
SHA=$$(git rev-parse HEAD); \
gh release create "$$NEW" --draft --target "$$SHA" --generate-notes --title "$$NEW" || exit 1; \
git push origin "$$SHA:refs/tags/$$NEW" || { gh release delete "$$NEW" --yes; exit 1; }
+7 -6
View File
@@ -499,16 +499,17 @@ token mint.
```bash
make build # -> dist/agentpr, dist/watchpr, dist/agentws, dist/agentvault, dist/agentreview, dist/agentgh
make test # go test -race ./...
make rpm # build + package dist/agent-tools-<version>-1.x86_64.rpm
make test # go test ./...
make rpm # goreleaser snapshot -> dist/ binaries + agent-tools RPM (unsigned)
```
Release is tag-driven (`v*`) via Woodpecker: builds the RPM, `PUT`s it to the
artifactapi `rpm-internal` yum repo, and cuts a Gitea release with
cross-compiled binaries attached.
Release is tag-driven (`v*`) via GitHub Actions: goreleaser builds the
linux/darwin amd64/arm64 binaries and the amd64 RPM (all six binaries plus
bash/zsh/fish completions), signs the checksums and publishes them on the
[GitHub release](https://github.com/IUCLabs/agent-tools/releases).
### Version bump
```bash
make patch # or: make minor / make major — tags vX.Y.Z and pushes the tag
make patch # or: make minor / make major — drafts the GitHub release, then pushes the tag
```
+1 -1
View File
@@ -21,7 +21,7 @@ import (
"strings"
"syscall"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -16,7 +16,7 @@ import (
"strings"
"testing"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
)
func TestCredentialGetHostFiltering(t *testing.T) {
+1 -1
View File
@@ -18,7 +18,7 @@ import (
"fmt"
"os"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"os"
"strings"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -29,7 +29,7 @@ import (
"sort"
"strings"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"strings"
"testing"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
)
// newFixtureOn builds the same origin/source/worktree-root layout as the prune
+1 -1
View File
@@ -11,7 +11,7 @@ import (
"strings"
"text/tabwriter"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -13,7 +13,7 @@ import (
"strings"
"testing"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
)
// fixture is a bare origin plus a source checkout named "repo" and a worktree
+1 -1
View File
@@ -5,7 +5,7 @@ import (
"strings"
"testing"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
)
// addOtherRepoWorktree clones a second source repo "other" and gives it a
+1 -1
View File
@@ -32,7 +32,7 @@ import (
"strings"
"time"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
"github.com/spf13/cobra"
)
+1 -1
View File
@@ -12,7 +12,7 @@ import (
"testing"
"time"
"git.unkin.net/unkin/agent-tools/internal/agent"
"github.com/IUCLabs/agent-tools/internal/agent"
)
// A bad PR reference must fail the command (so main exits non-zero) rather than
+1 -1
View File
@@ -1,4 +1,4 @@
module git.unkin.net/unkin/agent-tools
module github.com/IUCLabs/agent-tools
go 1.25.7
-136
View File
@@ -1,136 +0,0 @@
---
# nfpm config for building the agent-tools RPM.
# Rendered through envsubst (see scripts/build-rpm.sh) then fed to `nfpm pkg`.
name: ${PACKAGE_NAME}
version: ${PACKAGE_VERSION}
release: ${PACKAGE_RELEASE}
arch: ${PACKAGE_ARCH}
platform: ${PACKAGE_PLATFORM}
section: default
priority: extra
description: "${PACKAGE_DESCRIPTION}"
maintainer: ${PACKAGE_MAINTAINER}
homepage: ${PACKAGE_HOMEPAGE}
license: ${PACKAGE_LICENSE}
disable_globbing: false
replaces:
- agent-tools
provides:
- agent-tools
contents:
# The CLI binaries.
- src: dist/agentpr
dst: /usr/bin/agentpr
file_info:
mode: 0755
owner: root
group: root
- src: dist/watchpr
dst: /usr/bin/watchpr
file_info:
mode: 0755
owner: root
group: root
- src: dist/agentws
dst: /usr/bin/agentws
file_info:
mode: 0755
owner: root
group: root
- src: dist/agentvault
dst: /usr/bin/agentvault
file_info:
mode: 0755
owner: root
group: root
- src: dist/agentreview
dst: /usr/bin/agentreview
file_info:
mode: 0755
owner: root
group: root
- src: dist/agentgh
dst: /usr/bin/agentgh
file_info:
mode: 0755
owner: root
group: root
# Shell completions (generated by scripts/build-rpm.sh before packaging).
- src: dist/completions/agentpr.bash
dst: /usr/share/bash-completion/completions/agentpr
file_info:
mode: 0644
- src: dist/completions/_agentpr
dst: /usr/share/zsh/site-functions/_agentpr
file_info:
mode: 0644
- src: dist/completions/agentpr.fish
dst: /usr/share/fish/vendor_completions.d/agentpr.fish
file_info:
mode: 0644
- src: dist/completions/watchpr.bash
dst: /usr/share/bash-completion/completions/watchpr
file_info:
mode: 0644
- src: dist/completions/_watchpr
dst: /usr/share/zsh/site-functions/_watchpr
file_info:
mode: 0644
- src: dist/completions/watchpr.fish
dst: /usr/share/fish/vendor_completions.d/watchpr.fish
file_info:
mode: 0644
- src: dist/completions/agentws.bash
dst: /usr/share/bash-completion/completions/agentws
file_info:
mode: 0644
- src: dist/completions/_agentws
dst: /usr/share/zsh/site-functions/_agentws
file_info:
mode: 0644
- src: dist/completions/agentws.fish
dst: /usr/share/fish/vendor_completions.d/agentws.fish
file_info:
mode: 0644
- src: dist/completions/agentvault.bash
dst: /usr/share/bash-completion/completions/agentvault
file_info:
mode: 0644
- src: dist/completions/_agentvault
dst: /usr/share/zsh/site-functions/_agentvault
file_info:
mode: 0644
- src: dist/completions/agentvault.fish
dst: /usr/share/fish/vendor_completions.d/agentvault.fish
file_info:
mode: 0644
- src: dist/completions/agentreview.bash
dst: /usr/share/bash-completion/completions/agentreview
file_info:
mode: 0644
- src: dist/completions/_agentreview
dst: /usr/share/zsh/site-functions/_agentreview
file_info:
mode: 0644
- src: dist/completions/agentreview.fish
dst: /usr/share/fish/vendor_completions.d/agentreview.fish
file_info:
mode: 0644
- src: dist/completions/agentgh.bash
dst: /usr/share/bash-completion/completions/agentgh
file_info:
mode: 0644
- src: dist/completions/_agentgh
dst: /usr/share/zsh/site-functions/_agentgh
file_info:
mode: 0644
- src: dist/completions/agentgh.fish
dst: /usr/share/fish/vendor_completions.d/agentgh.fish
file_info:
mode: 0644
-49
View File
@@ -1,49 +0,0 @@
#!/usr/bin/env bash
#
# Package the (already built) agentpr, watchpr, agentws, agentvault, agentreview and agentgh binaries into an RPM
# with nfpm, bundling generated bash/zsh/fish shell completions.
# Usage: scripts/build-rpm.sh [version] (version defaults to $CI_COMMIT_TAG)
#
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${ROOT_DIR}"
VERSION="${1:-${CI_COMMIT_TAG:-0.0.0-dev}}"
VERSION="${VERSION#v}" # strip a leading v
PACKAGE="agent-tools"
BINARIES=(agentpr watchpr agentws agentvault agentreview agentgh)
DIST="dist"
for b in "${BINARIES[@]}"; do
if [ ! -f "${DIST}/${b}" ]; then
echo "ERROR: ${DIST}/${b} not found; run 'make build' first" >&2
exit 1
fi
done
# Generate shell completions from the freshly built binaries so they always
# match the shipped flags/subcommands.
COMP_DIR="${DIST}/completions"
mkdir -p "${COMP_DIR}"
for b in "${BINARIES[@]}"; do
"./${DIST}/${b}" completion bash >"${COMP_DIR}/${b}.bash"
"./${DIST}/${b}" completion zsh >"${COMP_DIR}/_${b}"
"./${DIST}/${b}" completion fish >"${COMP_DIR}/${b}.fish"
done
export PACKAGE_NAME="${PACKAGE}"
export PACKAGE_VERSION="${VERSION}"
export PACKAGE_RELEASE="1"
export PACKAGE_ARCH="amd64"
export PACKAGE_PLATFORM="linux"
export PACKAGE_DESCRIPTION="CLI tools for automation as the unkin-agent user: agentpr (create PRs/comments), watchpr (poll PRs and alert on meaningful change), agentws (manage per-branch git worktrees), agentvault (deterministic Vault flows), agentreview (GitHub webhook PR reviewer) and agentgh (gh/git as a GitHub App)"
export PACKAGE_MAINTAINER="Ben Vincent <ben@unkin.net>"
export PACKAGE_HOMEPAGE="https://git.unkin.net/unkin/agent-tools"
export PACKAGE_LICENSE="MIT"
envsubst <packaging/nfpm.yaml >"${DIST}/nfpm.yaml"
nfpm pkg --config "${DIST}/nfpm.yaml" --target "${DIST}" --packager rpm
echo "Built:"
ls -1 "${DIST}"/*.rpm
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Generate bash/zsh/fish completions for every tool, named as installed.
set -euo pipefail
mkdir -p completions/bash completions/zsh completions/fish
for b in agentpr watchpr agentws agentvault agentreview agentgh; do
go run "./cmd/$b" completion bash >"completions/bash/$b"
go run "./cmd/$b" completion zsh >"completions/zsh/_$b"
go run "./cmd/$b" completion fish >"completions/fish/$b.fish"
done
+9
View File
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
# Detached binary signature of $1 into $2 via the Vault gpg engine.
set -euo pipefail
b=$(base64 -w0 "$1")
jq -n --arg input "$b" '{input: $input, format: "base64"}' \
| curl -sSf --cacert "${VAULT_CACERT:-/etc/vault-ca/ca.crt}" \
-H "X-Vault-Token: ${VAULT_TOKEN}" -d @- \
"${VAULT_ADDR}/v1/gpg/sign/iuclabs-release" \
| jq -er .data.signature | base64 -d > "$2"