54 lines
1.0 KiB
Bash
Executable File
54 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
usage() {
|
|
cat <<'EOF'
|
|
Usage: gori-agent <command> [arguments]
|
|
|
|
Instance commands:
|
|
instance init <bot-id>
|
|
instance start <bot-id>
|
|
instance stop <bot-id>
|
|
instance restart <bot-id>
|
|
instance status <bot-id>
|
|
instance logs <bot-id>
|
|
instance doctor <bot-id>
|
|
instance list
|
|
|
|
Debug commands:
|
|
setup [--config path]
|
|
discover-backends [--json]
|
|
start --config path
|
|
status --config path
|
|
doctor --config path
|
|
print feishu --config path
|
|
|
|
Instances live under ${GORI_AGENT_ROOT:-$HOME/.gori-agent}/instances/<bot-id>.
|
|
config.example.json is documentation only and is never used as runtime config.
|
|
EOF
|
|
}
|
|
|
|
ensure_build() {
|
|
if [[ ! -f "$ROOT_DIR/dist/cli.js" ]]; then
|
|
echo "dist/cli.js not found; building..."
|
|
npm run build --prefix "$ROOT_DIR"
|
|
fi
|
|
}
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
case "$1" in
|
|
--help|-h|help)
|
|
usage
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
ensure_build
|
|
exec node "$ROOT_DIR/dist/cli.js" "$@"
|