nix-hermes-agent/checks.nix
Ciphercat 1d95780fff fix: missing minisweagent_path module + add nix checks
- Patch upstream pyproject.toml to include minisweagent_path in py-modules
- Copy mini-swe-agent/src/minisweagent into package for importability
- Add 3 nix checks: package-contents, cli-commands, doctor
- All binaries tested: hermes, hermes-agent, hermes-acp
- hermes gateway, config, status, claw migrate all verified working
2026-03-16 01:15:24 +00:00

76 lines
3.1 KiB
Nix

{ pkgs, hermes-agent }:
{
# Verify package contents — binaries exist and are executable
package-contents = pkgs.runCommand "hermes-package-contents" { } ''
set -e
echo "=== Checking binaries ==="
test -x ${hermes-agent}/bin/hermes || (echo "FAIL: hermes binary missing"; exit 1)
test -x ${hermes-agent}/bin/hermes-agent || (echo "FAIL: hermes-agent binary missing"; exit 1)
test -x ${hermes-agent}/bin/hermes-acp || (echo "FAIL: hermes-acp binary missing"; exit 1)
echo "PASS: All binaries present"
echo "=== Checking version ==="
${hermes-agent}/bin/hermes version 2>&1 | grep -q "Hermes Agent" || (echo "FAIL: version check"; exit 1)
echo "PASS: Version check"
echo "=== Checking key Python modules ==="
SITE=${hermes-agent}/lib/python3.12/site-packages
for mod in agent cli.py gateway cron tools run_agent.py model_tools.py minisweagent_path.py acp_adapter honcho_integration; do
if [ ! -e "$SITE/$mod" ] && [ ! -e "$SITE/$mod.py" ]; then
echo "FAIL: Missing module $mod"
exit 1
fi
done
echo "PASS: All key modules present"
echo "=== Checking wrapped PATH includes runtime deps ==="
cat ${hermes-agent}/bin/hermes | grep -q "PATH" || (echo "FAIL: hermes not wrapped with PATH"; exit 1)
echo "PASS: PATH wrapping"
echo "=== All checks passed ==="
mkdir -p $out
echo "ok" > $out/result
'';
# Verify hermes CLI subcommands are accessible
cli-commands = pkgs.runCommand "hermes-cli-commands" { } ''
set -e
export HOME=$(mktemp -d)
echo "=== Checking hermes --help ==="
${hermes-agent}/bin/hermes --help 2>&1 | grep -q "gateway" || (echo "FAIL: gateway subcommand missing"; exit 1)
${hermes-agent}/bin/hermes --help 2>&1 | grep -q "claw" || (echo "FAIL: claw subcommand missing"; exit 1)
${hermes-agent}/bin/hermes --help 2>&1 | grep -q "config" || (echo "FAIL: config subcommand missing"; exit 1)
${hermes-agent}/bin/hermes --help 2>&1 | grep -q "cron" || (echo "FAIL: cron subcommand missing"; exit 1)
${hermes-agent}/bin/hermes --help 2>&1 | grep -q "skills" || (echo "FAIL: skills subcommand missing"; exit 1)
${hermes-agent}/bin/hermes --help 2>&1 | grep -q "acp" || (echo "FAIL: acp subcommand missing"; exit 1)
echo "PASS: All subcommands accessible"
echo "=== Checking hermes config ==="
${hermes-agent}/bin/hermes config 2>&1 | grep -q "Config:" || (echo "FAIL: config output"; exit 1)
echo "PASS: Config command"
echo "=== Checking hermes claw migrate --help ==="
${hermes-agent}/bin/hermes claw migrate --help 2>&1 | grep -q "OpenClaw" || (echo "FAIL: claw migrate"; exit 1)
echo "PASS: Claw migrate"
echo "=== All CLI checks passed ==="
mkdir -p $out
echo "ok" > $out/result
'';
# Verify doctor runs without crashing
doctor = pkgs.runCommand "hermes-doctor" { } ''
set -e
export HOME=$(mktemp -d)
echo "=== Running hermes doctor ==="
${hermes-agent}/bin/hermes doctor 2>&1 | grep -q "Python" || (echo "FAIL: doctor"; exit 1)
echo "PASS: Doctor runs successfully"
mkdir -p $out
echo "ok" > $out/result
'';
}