From e38f7fc04fe7eb117ee568ef2ae902ea53528424 Mon Sep 17 00:00:00 2001 From: ZN-Ice Date: Sun, 7 Jun 2026 21:06:26 +0800 Subject: [PATCH 1/2] fix(npm): add .npmignore to platform packages to include binaries The root .gitignore excludes packages/*/bin/ and packages/*/app/ to prevent build artifacts from being committed. However, npm uses .gitignore by default when deciding what to publish, which caused the platform packages to be published without the actual binaries. Users installing cli-box-skill via npm would get empty platform packages, causing the postinstall script to fail silently and the cli-box wrapper to not find the binary. Fix: Add .npmignore files to platform packages that override the .gitignore behavior, ensuring binaries are included in published packages. Closes # --- packages/cli-box-darwin-arm64/.npmignore | 3 +++ packages/cli-box-electron-darwin-arm64/.npmignore | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 packages/cli-box-darwin-arm64/.npmignore create mode 100644 packages/cli-box-electron-darwin-arm64/.npmignore diff --git a/packages/cli-box-darwin-arm64/.npmignore b/packages/cli-box-darwin-arm64/.npmignore new file mode 100644 index 0000000..f17637d --- /dev/null +++ b/packages/cli-box-darwin-arm64/.npmignore @@ -0,0 +1,3 @@ +# npm publish includes everything by default +# This overrides the root .gitignore which excludes bin/ +# We need bin/ in the published package diff --git a/packages/cli-box-electron-darwin-arm64/.npmignore b/packages/cli-box-electron-darwin-arm64/.npmignore new file mode 100644 index 0000000..07c42a0 --- /dev/null +++ b/packages/cli-box-electron-darwin-arm64/.npmignore @@ -0,0 +1,3 @@ +# npm publish includes everything by default +# This overrides the root .gitignore which excludes app/ +# We need app/ in the published package From b7d54b3a92e4f6d4bda54ccbdce76c2c43d2ada4 Mon Sep 17 00:00:00 2001 From: ZN-Ice Date: Sun, 7 Jun 2026 21:30:02 +0800 Subject: [PATCH 2/2] fix(test): add timeout to E2E functional test to prevent hanging The E2E skill installation test was hanging on 'cli-box start zsh' command because it waits for renderer WebSocket and terminal readiness (up to 125 seconds). In test environments where Electron cannot start (due to permissions or display issues), this causes the test to hang. Fix: Add 30-second timeout to the functional test. If the command doesn't complete within the timeout, skip the test with a warning. --- tests/e2e-skill-install.sh | 59 ++++++++++++++++++++++++++++++++------ 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/tests/e2e-skill-install.sh b/tests/e2e-skill-install.sh index 92fa166..caa9717 100755 --- a/tests/e2e-skill-install.sh +++ b/tests/e2e-skill-install.sh @@ -341,18 +341,59 @@ test_post_install_verify() { if [ "$(uname)" = "Darwin" ] && [ -z "${CI:-}" ]; then info " Running functional test (cli-box start zsh)..." local SANDBOX_ID - SANDBOX_ID=$("$TMP_HOME/.cli-box/bin/cli-box" start zsh 2>&1 | grep -oE '[a-f0-9]{6}' | head -1 || true) - if [ -n "$SANDBOX_ID" ]; then - sleep 3 - if "$TMP_HOME/.cli-box/bin/cli-box" list 2>&1 | grep -q "$SANDBOX_ID"; then - ok " Sandbox $SANDBOX_ID is running" - else - warn " Sandbox $SANDBOX_ID not found in list (may have exited)" + + # Use timeout to prevent hanging (macOS doesn't have timeout command) + # Run cli-box start in background and wait with timeout + local OUTPUT_FILE + OUTPUT_FILE=$(mktemp) + local PID_FILE + PID_FILE=$(mktemp) + + # Start cli-box in background + "$TMP_HOME/.cli-box/bin/cli-box" start zsh > "$OUTPUT_FILE" 2>&1 & + local CLI_PID=$! + echo "$CLI_PID" > "$PID_FILE" + + # Wait up to 30 seconds for output + local TIMEOUT=30 + local ELAPSED=0 + while [ $ELAPSED -lt $TIMEOUT ]; do + if ! kill -0 "$CLI_PID" 2>/dev/null; then + # Process finished + break + fi + if [ -s "$OUTPUT_FILE" ]; then + # Got some output + break fi - "$TMP_HOME/.cli-box/bin/cli-box" close "$SANDBOX_ID" 2>/dev/null || true + sleep 1 + ELAPSED=$((ELAPSED + 1)) + done + + # Check if process is still running (timeout case) + if kill -0 "$CLI_PID" 2>/dev/null; then + warn " cli-box start timed out after ${TIMEOUT}s, killing..." + kill "$CLI_PID" 2>/dev/null || true + wait "$CLI_PID" 2>/dev/null || true + warn " Functional test skipped (timeout - macOS permissions may be required)" else - warn " Could not start sandbox (macOS permissions may be required)" + # Process finished, check output + SANDBOX_ID=$(grep -oE '[a-f0-9]{6}' "$OUTPUT_FILE" | head -1 || true) + if [ -n "$SANDBOX_ID" ]; then + sleep 3 + if "$TMP_HOME/.cli-box/bin/cli-box" list 2>&1 | grep -q "$SANDBOX_ID"; then + ok " Sandbox $SANDBOX_ID is running" + else + warn " Sandbox $SANDBOX_ID not found in list (may have exited)" + fi + "$TMP_HOME/.cli-box/bin/cli-box" close "$SANDBOX_ID" 2>/dev/null || true + else + warn " Could not start sandbox (macOS permissions may be required)" + fi fi + + # Cleanup + rm -f "$OUTPUT_FILE" "$PID_FILE" else info " Skipping functional test (CI or non-macOS)" fi