From 441061fe5e30690b3add2ca22338ff4388f65c01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8E=8C=E6=98=9F?= Date: Fri, 26 Jun 2026 12:28:11 +0800 Subject: [PATCH] Avoid passing empty args to node scripts Make wrapper scripts omit the "${ARGS[@]}" expansion when no arguments are supplied. Each script now checks if ARGS is empty and invokes node with only the script path if so. Affects: scripts/install-for-current-provider.sh, scripts/launch-ui.sh, scripts/restore-codex-config.sh, scripts/start-gateway.sh, and scripts/stop-gateway.sh. This prevents an empty positional parameter from being passed to the .mjs entrypoints. --- scripts/install-for-current-provider.sh | 6 +++++- scripts/launch-ui.sh | 6 +++++- scripts/restore-codex-config.sh | 6 +++++- scripts/start-gateway.sh | 6 +++++- scripts/stop-gateway.sh | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/scripts/install-for-current-provider.sh b/scripts/install-for-current-provider.sh index 4cb85d9..334f1b9 100644 --- a/scripts/install-for-current-provider.sh +++ b/scripts/install-for-current-provider.sh @@ -29,4 +29,8 @@ if command -v node.exe >/dev/null 2>&1; then done ARGS=("${NORMALIZED_ARGS[@]}") fi -"$NODE_BIN" "$SCRIPT_DIR/install-for-current-provider.mjs" "${ARGS[@]}" +if [[ ${#ARGS[@]} -eq 0 ]]; then + "$NODE_BIN" "$SCRIPT_DIR/install-for-current-provider.mjs" +else + "$NODE_BIN" "$SCRIPT_DIR/install-for-current-provider.mjs" "${ARGS[@]}" +fi diff --git a/scripts/launch-ui.sh b/scripts/launch-ui.sh index e4eb335..15697b9 100644 --- a/scripts/launch-ui.sh +++ b/scripts/launch-ui.sh @@ -29,4 +29,8 @@ if command -v node.exe >/dev/null 2>&1; then done ARGS=("${NORMALIZED_ARGS[@]}") fi -"$NODE_BIN" "$SCRIPT_DIR/launch-ui.mjs" "${ARGS[@]}" +if [[ ${#ARGS[@]} -eq 0 ]]; then + "$NODE_BIN" "$SCRIPT_DIR/launch-ui.mjs" +else + "$NODE_BIN" "$SCRIPT_DIR/launch-ui.mjs" "${ARGS[@]}" +fi diff --git a/scripts/restore-codex-config.sh b/scripts/restore-codex-config.sh index c41a6d2..45507ee 100644 --- a/scripts/restore-codex-config.sh +++ b/scripts/restore-codex-config.sh @@ -29,4 +29,8 @@ if command -v node.exe >/dev/null 2>&1; then done ARGS=("${NORMALIZED_ARGS[@]}") fi -"$NODE_BIN" "$SCRIPT_DIR/restore-codex-config.mjs" "${ARGS[@]}" +if [[ ${#ARGS[@]} -eq 0 ]]; then + "$NODE_BIN" "$SCRIPT_DIR/restore-codex-config.mjs" +else + "$NODE_BIN" "$SCRIPT_DIR/restore-codex-config.mjs" "${ARGS[@]}" +fi diff --git a/scripts/start-gateway.sh b/scripts/start-gateway.sh index f543192..2e9e76e 100644 --- a/scripts/start-gateway.sh +++ b/scripts/start-gateway.sh @@ -29,4 +29,8 @@ if command -v node.exe >/dev/null 2>&1; then done ARGS=("${NORMALIZED_ARGS[@]}") fi -"$NODE_BIN" "$SCRIPT_DIR/start-gateway.mjs" "${ARGS[@]}" +if [[ ${#ARGS[@]} -eq 0 ]]; then + "$NODE_BIN" "$SCRIPT_DIR/start-gateway.mjs" +else + "$NODE_BIN" "$SCRIPT_DIR/start-gateway.mjs" "${ARGS[@]}" +fi diff --git a/scripts/stop-gateway.sh b/scripts/stop-gateway.sh index 674ac53..e96cd82 100644 --- a/scripts/stop-gateway.sh +++ b/scripts/stop-gateway.sh @@ -29,4 +29,8 @@ if command -v node.exe >/dev/null 2>&1; then done ARGS=("${NORMALIZED_ARGS[@]}") fi -"$NODE_BIN" "$SCRIPT_DIR/stop-gateway.mjs" "${ARGS[@]}" +if [[ ${#ARGS[@]} -eq 0 ]]; then + "$NODE_BIN" "$SCRIPT_DIR/stop-gateway.mjs" +else + "$NODE_BIN" "$SCRIPT_DIR/stop-gateway.mjs" "${ARGS[@]}" +fi