Simplify instance lifecycle commands

This commit is contained in:
zenord
2026-08-17 00:49:29 +08:00
parent f9fb4ef776
commit fe7bbd0631
13 changed files with 385 additions and 237 deletions
+13 -20
View File
@@ -7,23 +7,16 @@ 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
Commands:
init <bot-id>
setup <bot-id>
start <bot-id>
stop <bot-id>
restart <bot-id>
status <bot-id>
logs <bot-id>
doctor <bot-id>
list
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.
@@ -31,8 +24,8 @@ EOF
}
ensure_build() {
if [[ ! -f "$ROOT_DIR/dist/cli.js" ]]; then
echo "dist/cli.js not found; building..."
if [[ ! -f "$ROOT_DIR/dist/cli.js" || ! -f "$ROOT_DIR/dist/cli/instance-runner.js" ]]; then
echo "CLI build output not found; building..."
npm run build --prefix "$ROOT_DIR"
fi
}
@@ -43,7 +36,7 @@ if [[ $# -eq 0 ]]; then
fi
case "$1" in
--help|-h|help)
--help|-h)
usage
exit 0
;;