summaryrefslogtreecommitdiffhomepage
path: root/packaging
diff options
context:
space:
mode:
Diffstat (limited to 'packaging')
-rw-r--r--packaging/PKGBUILD43
1 files changed, 41 insertions, 2 deletions
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
+}