Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ dist-ssr
CodexMonitor.zip
.codex-worktrees/
.codexmonitor/
.codexmonitor-logs/
ilass-private/
.codexmonitor-artifacts/
src-tauri/gen/
codex-monitor-01.png
codex-monitor-IST.png
screen_random_32342.png
14 changes: 1 addition & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions scripts/ios-e2e-joke-device.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
set -euo pipefail

DEVICE_NAME="${1:-iPad von Peter (2)}"

export PATH="$HOME/.cargo/bin:$PATH"
export VITE_E2E=1

APPLE_TEAM_DEFAULT="ZAMR4EWP34"
export APPLE_DEVELOPMENT_TEAM="${APPLE_DEVELOPMENT_TEAM:-$APPLE_TEAM_DEFAULT}"
APP_BUNDLE_ID="${APP_BUNDLE_ID:-com.ilass.codexmonitor}"

echo "[ios-e2e] Device: ${DEVICE_NAME}"
echo "[ios-e2e] Team: ${APPLE_DEVELOPMENT_TEAM}"
echo "[ios-e2e] Building (debug, device aarch64) with VITE_E2E=1..."
rm -rf "${PWD}/src-tauri/gen/apple/build" || true
if [[ ! -d "${PWD}/src-tauri/gen/apple" ]]; then
npx tauri ios init
fi
npx tauri ios build --debug --target aarch64

echo "[ios-e2e] Looking for CodexMonitor.app (debug-iphoneos)..."
UDID="$(
xcrun xctrace list devices 2>/dev/null \
| grep -F "${DEVICE_NAME}" \
| head -n 1 \
| sed -n 's/.*(\([0-9a-fA-F-]\{8,\}\)).*/\1/p'
)"
if [[ -z "${UDID}" ]]; then
echo "[ios-e2e] ERROR: Could not find UDID for device: ${DEVICE_NAME}" >&2
exit 1
fi

APP_PATH="$(
find "$HOME/Library/Developer/Xcode/DerivedData" \
-type d \
-path '*/Build/Products/debug-iphoneos/CodexMonitor.app' \
-print0 \
| xargs -0 ls -td 2>/dev/null \
| head -n 1 \
|| true
)"

if [[ -z "${APP_PATH}" ]]; then
echo "[ios-e2e] ERROR: Could not find built CodexMonitor.app in DerivedData." >&2
exit 1
fi

echo "[ios-e2e] Installing app: ${APP_PATH}"
xcrun devicectl device install app --device "${UDID}" "${APP_PATH}"

echo "[ios-e2e] Launching bundle id: ${APP_BUNDLE_ID}"
xcrun devicectl device process launch --terminate-existing --device "${UDID}" "${APP_BUNDLE_ID}"

echo "[ios-e2e] Launched. The app should auto-run the E2E joke test (Status should become PASS)."
75 changes: 75 additions & 0 deletions scripts/ios-ui-screenshot-sim.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/usr/bin/env bash
set -euo pipefail

SIM_NAME="${1:-iPad (A16)}"

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
ART_DIR="${ROOT_DIR}/.codexmonitor-artifacts/ios"
mkdir -p "${ART_DIR}"

export PATH="$HOME/.cargo/bin:$PATH"
export VITE_E2E="${VITE_E2E:-1}"
APP_BUNDLE_ID="${APP_BUNDLE_ID:-com.ilass.codexmonitor}"
WAIT_SECS="${WAIT_SECS:-18}"

echo "[ios-sim-shot] Simulator: ${SIM_NAME}"

SIM_LINE="$(xcrun simctl list devices | grep -F "${SIM_NAME} (" | head -n 1 || true)"
if [[ -z "${SIM_LINE}" ]]; then
echo "[ios-sim-shot] ERROR: simulator not found: ${SIM_NAME}" >&2
exit 1
fi
SIM_UDID="$(echo "${SIM_LINE}" | sed -n 's/.*(\([0-9A-Fa-f-]\{8,\}\)).*/\1/p')"
if [[ -z "${SIM_UDID}" ]]; then
echo "[ios-sim-shot] ERROR: failed to parse simulator UDID." >&2
exit 1
fi

echo "[ios-sim-shot] UDID: ${SIM_UDID}"
xcrun simctl boot "${SIM_UDID}" >/dev/null 2>&1 || true
xcrun simctl bootstatus "${SIM_UDID}" -b

echo "[ios-sim-shot] Building (aarch64-sim)..."
rm -rf "${ROOT_DIR}/src-tauri/gen/apple/build" || true
if [[ ! -d "${ROOT_DIR}/src-tauri/gen/apple" ]]; then
(cd "${ROOT_DIR}" && npx tauri ios init)
fi
(cd "${ROOT_DIR}" && npx tauri ios build --debug --target aarch64-sim)

APP_PATH="$(
find "$HOME/Library/Developer/Xcode/DerivedData" \
-type d \
\( -path '*/Build/Products/Debug-iphonesimulator/CodexMonitor.app' -o -path '*/Build/Products/debug-iphonesimulator/CodexMonitor.app' \) \
-print0 \
| xargs -0 ls -td 2>/dev/null \
| head -n 1 \
|| true
)"
if [[ -z "${APP_PATH}" ]]; then
echo "[ios-sim-shot] ERROR: could not find built CodexMonitor.app (iphonesimulator)." >&2
exit 1
fi

echo "[ios-sim-shot] Installing: ${APP_PATH}"
xcrun simctl uninstall "${SIM_UDID}" "${APP_BUNDLE_ID}" >/dev/null 2>&1 || true
xcrun simctl install "${SIM_UDID}" "${APP_PATH}"

echo "[ios-sim-shot] Launching..."
STAMP="$(date +%Y%m%d-%H%M%S)"
STDOUT_LOG="${ART_DIR}/sim-${SIM_UDID}-${STAMP}.stdout.log"
STDERR_LOG="${ART_DIR}/sim-${SIM_UDID}-${STAMP}.stderr.log"
xcrun simctl launch \
--terminate-running-process \
--stdout="${STDOUT_LOG}" \
--stderr="${STDERR_LOG}" \
"${SIM_UDID}" \
"${APP_BUNDLE_ID}" \
>/dev/null || true

sleep "${WAIT_SECS}"

OUT="${ART_DIR}/sim-${SIM_UDID}-${STAMP}.png"
echo "[ios-sim-shot] Screenshot: ${OUT}"
xcrun simctl io "${SIM_UDID}" screenshot "${OUT}"

echo "[ios-sim-shot] Done."
27 changes: 27 additions & 0 deletions scripts/macos-runner-dev-bg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash
set -euo pipefail

ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
LOG_DIR="${ROOT_DIR}/.codexmonitor-logs"
PID_FILE="${LOG_DIR}/macos-runner.pid"
LOG_FILE="${LOG_DIR}/macos-runner.log"

mkdir -p "${LOG_DIR}"

if [[ -f "${PID_FILE}" ]]; then
PID="$(cat "${PID_FILE}" || true)"
if [[ -n "${PID}" ]] && kill -0 "${PID}" 2>/dev/null; then
echo "[runner] Already running (pid=${PID}). Logs: ${LOG_FILE}"
exit 0
fi
fi

export PATH="$HOME/.cargo/bin:$PATH"

echo "[runner] Starting macOS runner in background..."
echo "[runner] Logs: ${LOG_FILE}"

nohup bash -c "export PATH=\"$HOME/.cargo/bin:\$PATH\"; cd \"${ROOT_DIR}\" && npm run tauri dev" >"${LOG_FILE}" 2>&1 &
echo $! > "${PID_FILE}"

echo "[runner] Started (pid=$(cat "${PID_FILE}"))."
Loading