diff options
| -rwxr-xr-x | bin/install-pkg | 6 | ||||
| -rw-r--r-- | packaging/PKGBUILD | 43 |
2 files changed, 44 insertions, 5 deletions
diff --git a/bin/install-pkg b/bin/install-pkg index 72e218b..9665847 100755 --- a/bin/install-pkg +++ b/bin/install-pkg @@ -5,7 +5,7 @@ # Pass package names (without version) to install a custom set. # # Usage: -# bin/install-pkg # dispatch + dispatch-systemd +# bin/install-pkg # dispatch + dispatch-systemd + code-search # bin/install-pkg dispatch dispatch-s6 # dispatch + dispatch-s6 # bin/install-pkg dispatch dispatch-electron # dispatch + electron wrapper # bin/install-pkg --all # every freshest pkg found @@ -35,9 +35,9 @@ declare -a names declare -a paths if [ $# -eq 0 ]; then - names=(dispatch dispatch-systemd) + names=(dispatch dispatch-systemd code-search) elif [ "${1:-}" = "--all" ]; then - names=(dispatch dispatch-systemd dispatch-s6 dispatch-electron) + names=(dispatch dispatch-systemd dispatch-s6 dispatch-electron code-search) else names=("$@") fi diff --git a/packaging/PKGBUILD b/packaging/PKGBUILD index a9a5b5c..4fd96d2 100644 --- a/packaging/PKGBUILD +++ b/packaging/PKGBUILD @@ -11,13 +11,17 @@ # bin/build-pkg # makepkg -fd in packaging/ pkgbase=dispatch -pkgname=('dispatch' 'dispatch-systemd' 'dispatch-s6') +pkgname=('dispatch' 'dispatch-systemd' 'dispatch-s6' 'code-search') pkgver=0.0.1 pkgrel=1 arch=('x86_64') url='https://github.com/anomalyco/dispatch' license=('MIT') -makedepends=('bun') +makedepends=('bun' 'go' 'git') + +# Pinned cs (code spelunker) commit (tag v3.1.0) built for the search_code tool. +# Kept in lockstep with the Docker build (see Dockerfile / Dockerfile.dev). +_cs_commit=697e0bf194bbc7a4a877e5170c70618989fc92e7 # All static files are read directly from ${_projectdir}/packaging/. We don't # use source=() because two of the s6 files share basenames (run, type), which # would collide inside ${srcdir}. @@ -56,6 +60,18 @@ build() { # Slim node_modules for runtime rm -rf node_modules bun install --frozen-lockfile --production + + # --- Build the patched `cs` code-search binary for the search_code tool --- + # Clone the pinned cs commit, apply the Luau declaration patch, and build a + # statically-linked binary. cs vendors its deps, so `go build -mod=vendor` + # needs no network beyond the clone. Mirrors the Docker cs-builder stage. + git clone https://github.com/boyter/cs.git "${srcdir}/cs-src" + cd "${srcdir}/cs-src" + git checkout "${_cs_commit}" + git apply "${_projectdir}/docker/cs/luau-declarations.patch" + CGO_ENABLED=0 GOFLAGS=-mod=vendor GOPATH="${srcdir}/gopath" GOCACHE="${srcdir}/gocache" \ + go build -ldflags="-s -w" -o "${srcdir}/cs" . + "${srcdir}/cs" --version } # ---------------------------------------------------------------------------- @@ -207,3 +223,26 @@ package_dispatch-s6() { install -Dm644 "${_packagingdir}/s6/dispatch-frontend-log/notification-fd" \ "${pkgdir}/etc/s6/sv/dispatch-frontend-log/notification-fd" } + + +# ---------------------------------------------------------------------------- +# code-search — patched `cs` (code spelunker) binary +# +# A standalone, relevance-ranked code search CLI (github.com/boyter/cs), built +# from a pinned commit with an added Luau declaration table (see +# docker/cs/luau-declarations.patch). Powers Dispatch's `search_code` agent +# tool, but is a self-contained binary usable on its own. Built once in build() +# and installed to /usr/bin/cs. +# ---------------------------------------------------------------------------- +package_code-search() { + pkgdesc='code spelunker (cs) — fast, relevance-ranked code search CLI (patched for Luau)' + depends=() + url='https://github.com/boyter/cs' + + install -Dm755 "${srcdir}/cs" "${pkgdir}/usr/bin/cs" + + if [ -f "${srcdir}/cs-src/LICENSE" ]; then + install -Dm644 "${srcdir}/cs-src/LICENSE" \ + "${pkgdir}/usr/share/licenses/code-search/LICENSE" + fi +} |
