# Maintainer: dax # Maintainer: adam pkgname='opencode' pkgver=1.0.20 _subver= options=('!debug' '!strip') pkgrel=1 pkgdesc='The AI coding agent built for the terminal.' url='https://github.com/sst/opencode' arch=('aarch64' 'x86_64') license=('MIT') provides=('opencode') conflicts=('opencode-bin') depends=('fzf' 'ripgrep') makedepends=('git' 'bun-bin' 'go' 'npm') source=("opencode-${pkgver}.tar.gz::https://github.com/sst/opencode/archive/v${pkgver}${_subver}.tar.gz") sha256sums=('b19aae9a36e828f7a3a13ef8e57d341085ee4f038e26df8831b919901a883650') build() { cd "opencode-${pkgver}" # Ensure npm is in PATH for bun's shell export PATH="/usr/bin:$PATH" bun install cd ./packages/opencode OPENCODE_CHANNEL=latest OPENCODE_VERSION=1.0.20 bun run ./script/build.ts --single } package() { cd "opencode-${pkgver}/packages/opencode" # Determine architecture for the binary path case "${CARCH}" in x86_64) _arch="x64" ;; aarch64) _arch="arm64" ;; esac install -Dm755 "./dist/opencode-linux-${_arch}/bin/opencode" "${pkgdir}/usr/bin/opencode" }