feat(runtime): add pi-coding-agent package with CLI tools

- Added pi-coding-agent package definition with buildNpmPackage
- Includes npm dependencies and native/build inputs for GUI libraries
- Skips generate-models step during build (models already in repo)
- Creates 'pi' executable pointing to coding-agent dist/cli.js
- Includes update.sh script for version/hash maintenance

Fixes build issues where generate-models would fail during build phase
This commit is contained in:
2026-02-05 10:22:07 -05:00
parent 6a48a33caa
commit 6f5d1ac499
2 changed files with 100 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
#!/usr/bin/env nix
#!nix shell --ignore-environment .#cacert .#nodejs .#git .#nix-update .#nix .#gnused .#findutils .#bash --command bash
set -euo pipefail
version=$(npm view @mariozechner/pi-coding-agent version)
# Update version and hashes
nix-update pi-coding-agent --version="$version" --generate-lockfile
# nix-update can't update package-lock.json along with npmDepsHash
# TODO: Remove this workaround if nix-update can update package-lock.json along with npmDepsHash.
(nix-build --expr '((import ./.) { system = builtins.currentSystem; }).pi-coding-agent.npmDeps.overrideAttrs { outputHash = ""; outputHashAlgo = "sha256"; }' 2>&1 || true) \
| sed -nE '$s/ *got: *(sha256-[A-Za-z0-9+/=-]+).*/\1/p' \
| xargs -I{} sed -i 's|npmDepsHash = "sha256-[^"]*";|npmDepsHash = "{}";|' pkgs/by-name/pi/pi-coding-agent/package.nix