blob: 27edcb65923946def63ac86c7ab12e6c06ec774d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
# Maintainer: Amin Vakil <info AT aminvakil DOT com>
pkgname=pi
pkgver=1.5.2
pkgrel=1
pkgdesc="AI coding agent for the terminal — minimal, extensible and optimized for tool use"
arch=('x86_64' 'aarch64')
url="https://github.com/earendil-works/pi"
license=('MIT')
depends=('nodejs>=22')
makedepends=('npm')
optdepends=(
'tmux: for background bash capabilities'
'fd: system-provided backend for the find tool'
'ripgrep: system-provided backend for the grep tool'
)
options=('!strip' '!debug')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz"
"pi-ai-${pkgver}.tgz::https://registry.npmjs.org/@earendil-works/pi-ai/-/pi-ai-${pkgver}.tgz")
sha256sums=('94321178a3d13e3f5660687c012c79cc93e586dfcf52c2707afd07093bf97f16'
'd5715efa834c23bfdf10a042b49df4ee169cc99000bf16d7998fab2d533b45f8')
prepare() {
rm -rf "${srcdir}/${pkgname}-${pkgver}/packages/ai/src/providers/data"
cp -a "${srcdir}/package/dist/providers/data" \
"${srcdir}/${pkgname}-${pkgver}/packages/ai/src/providers/"
}
build() {
cd "${pkgname}-${pkgver}"
npm ci --cache "${srcdir}/npm-cache" --ignore-scripts --no-audit --no-fund
npm run build:offline
# Remove packages which are only necessary in development / building
npm prune --omit=dev --ignore-scripts --no-audit --no-fund --cache "${srcdir}/npm-cache"
}
package() {
cd "${pkgname}-${pkgver}"
local mod_dir="/usr/lib/node_modules/$pkgname"
install -dm755 "$pkgdir/$mod_dir/node_modules" \
"$pkgdir/usr/bin" \
"$pkgdir/usr/share/doc/$pkgname"
cp -a node_modules/. "$pkgdir/$mod_dir/node_modules/"
local _pkg
for _pkg in ai agent tui telemetry chord coding-agent codemode mcp schema; do
install -dm755 "$pkgdir/$mod_dir/packages/$_pkg"
cp -a "packages/$_pkg/dist" "packages/$_pkg/package.json" "packages/$_pkg/README.md" \
"$pkgdir/$mod_dir/packages/$_pkg/"
if [[ -d "packages/$_pkg/node_modules" ]]; then
cp -a "packages/$_pkg/node_modules" "$pkgdir/$mod_dir/packages/$_pkg/"
fi
done
# Copy the additional files for coding-agent
cp -a packages/coding-agent/{docs,examples,CHANGELOG.md} \
"$pkgdir/$mod_dir/packages/coding-agent/"
ln -s "$mod_dir/packages/coding-agent/dist/bundle/cli.js" "$pkgdir/usr/bin/pi"
# Copy coding-agent docs and README and CHANGELOG into /usr/share/doc/pi to align it with Arch packages
cp -r packages/coding-agent/docs/* packages/coding-agent/examples "$pkgdir/usr/share/doc/$pkgname/"
install -m644 packages/coding-agent/{README,CHANGELOG}.md "$pkgdir/usr/share/doc/$pkgname/"
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
|