#!/run/current-system/sw/bin/nix
#! nix shell nixpkgs#nushell --command nu

$env.PATH = ["/run/current-system/sw/bin"] ++ $env.PATH

source ./hey.d/common.nu
source ./hey.d/opencode.nu
source ./hey.d/rebuild.nu
source ./hey.d/hermes.nu
source ./hey.d/flake.nu
source ./hey.d/nix.nu
source ./hey.d/remote.nu
source ./hey.d/test.nu
source ./hey.d/ergodox.nu
source ./hey.d/skillkit.nu
source ./hey.d/skills-catalog.nu
source ./hey.d/zbench.nu
source ./hey.d/agent-quality.nu

def hey-help [] {
  let ctx = (context)
  print "Usage: hey <command> [args...]"
  print ""
  print "System"
  print "  rebuild, re, test, rollback, hermes-local"
  print "  update, u, upgrade, check [--worktree] [paths...], show"
  print "  gc, repl, search, shell, setup-caches"
  print ""
  print "Remote"
  print "  deploy, deploy-dry, deploy-check"
  print "  nuc [auto|switch|test|dry-activate|build|vm|local|wt <mode>], rebuild-nuc, nuc-worktree/nuc-wt [mode], nuc-ssh, nuc-status, nuc-hermes-smoke, nuc-service, nuc-logs, nuc-rollback, nuc-generations"
  print "  login-scintillate, login-betty"
  print "  unas, unas-ssh"
  print "  agents-rollout"
  print ""
  print "Ergodox"
  print "  ergodox-build, ergodox-flash, ergodox-build-flash, ergodox-edit, ergodox-draw, ergodox-info"
  print ""
  print "Skills"
  print "  skills-update, skills-sync, skills-bump, skills-cleanup-local-leaks, skillkit-sync"
  print ""
  print "Benchmark/Test"
  print "  ztest"
  print "  zbench, zbench-save, zbench-compare, zbench-check, zbench-baseline, zbench-history"
  print "  agent-review, agent-audit-tests, agent-sweep, agent-finish, agent-inventory, agent-worklog-check"
  print ""
  print "Other"
  print "  opencode-update"
  print ""
  print $"Flake host: ($ctx.flake_host)"
  print $"Platform: ($ctx.os_name)"
  print ""
  print "Tip: use 'hey <command> --help' for command-specific usage."
}

def "main help" [] {
  hey-help
}

export def main [] {
  hey-help
}
