Repository Public
1#!/bin/zsh2# =============================================================================3# SP BOUCHER | INFRASTRUCTURE & AUTOMATION4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# Project : Claude Remote / Codex Remote8# File : Scripts/kit.sh9# Module : Scripts10# Repository : https://git.spboucher.ai/claude-remote-apple11# Project Website : https://claude.spboucher.ai12# Created : 2026-11-2913# Last Modified : 2026-11-2914#15# Author : Simon-Pierre Boucher16# Position : Professor of Finance17# Institution : Université du Québec en Outaouais (UQO)18# Organization : SP Boucher19# Website : https://spboucher.ai20# Git : https://git.spboucher.ai21#22# Preferred Contact: support@spboucher.ai23# Technical Contact: dev@spboucher.ai24# Security/Admin : admin@spboucher.ai25#26# Copyright (c) 202627# Simon-Pierre Boucher28# All rights reserved where applicable. This file is governed by the29# applicable project license, copyright notices and relevant law.30# Existing third-party rights and notices remain unaffected.31#32# License : None specified (no license file in this repository)33#34# Do not embed credentials, private keys, access tokens,35# certificates or confidential personal information.36#37# =============================================================================38# END OF SP BOUCHER SOURCE HEADER39# =============================================================================4041# Build / test the shared Swift package with filtered output.42# Scripts/kit.sh build swift build (macOS, debug)43# Scripts/kit.sh build-macos xcodebuild, platform=macOS44# Scripts/kit.sh build-ios xcodebuild, iOS Simulator ("CR iPhone 17 Pro", created if missing)45# Scripts/kit.sh test [filter] swift test (macOS); optional --filter expression46# Scripts/kit.sh test-integration swift test --filter IntegrationTests (needs CR_IT_BASE_URL + CR_IT_FIXTURES)47# Scripts/kit.sh all build + build-macos + build-ios + test48set -u49ROOT="$(cd "$(dirname "$0")/.." && pwd)"50PKG="$ROOT/Packages/ClaudeRemoteKit"51DD="$ROOT/build/dd-kit"52SCHEME="ClaudeRemoteKit-Package"53SIM_NAME="CR iPhone 17 Pro"5455# Keeps compiler diagnostics and summaries, drops the per-file command lines.56filter() {57 grep -E "error:|warning: (unre|var |imm|capture|sending|call to|non-sendable|main actor|expression)|\*\* [A-Z ]+ \*\*|Compiling|Build complete|✔|✘|Test run|Suite .* (passed|failed)|recorded an issue|failed|passed after|Executed|skipped" \58 | grep -v "^Failed frontend command" | grep -v "swift-frontend" | cut -c1-40059}6061sim_id() {62 local id63 id=$(xcrun simctl list devices available | grep -F "$SIM_NAME (" | head -1 | sed -E 's/.*\(([0-9A-F-]{36})\).*/\1/')64 if [[ -z "$id" ]]; then65 local runtime66 runtime=$(xcrun simctl list runtimes available | grep -E "^iOS" | tail -1 | sed -E 's/.* - (com\.apple\.[^ ]+).*/\1/')67 id=$(xcrun simctl create "$SIM_NAME" "iPhone 17 Pro" "$runtime")68 fi69 echo "$id"70}7172cmd="${1:-all}"73shift 2>/dev/null || true74cd "$PKG" || exit 175case "$cmd" in76 build)77 swift build 2>&1 | filter; exit ${pipestatus[1]} ;;78 build-macos)79 xcodebuild build -scheme "$SCHEME" -destination 'platform=macOS' -derivedDataPath "$DD" -skipPackagePluginValidation -quiet 2>&1 | filter80 exit ${pipestatus[1]} ;;81 build-ios)82 xcodebuild build -scheme "$SCHEME" -destination "platform=iOS Simulator,id=$(sim_id)" -derivedDataPath "$DD" -skipPackagePluginValidation -quiet 2>&1 | filter83 exit ${pipestatus[1]} ;;84 test)85 if [[ $# -gt 0 ]]; then swift test --filter "$1" 2>&1 | filter; else swift test 2>&1 | filter; fi86 exit ${pipestatus[1]} ;;87 test-integration)88 swift test --filter IntegrationTests 2>&1 | filter; exit ${pipestatus[1]} ;;89 all)90 "$0" build && "$0" build-macos && "$0" build-ios && "$0" test ;;91 *)92 echo "usage: kit.sh build|build-macos|build-ios|test [filter]|test-integration|all"; exit 2 ;;93esac94