From c4da2dd7c12c31651d7cc4bea8d1fe1774a64aa4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Wed, 6 Aug 2025 19:01:20 +0200 Subject: [PATCH] Add Poltergeist integration for automatic builds (#514) --- .github/workflows/claude-code-review.yml | 2 +- .github/workflows/claude.yml | 2 +- .github/workflows/run-gemini-cli.yml | 23 +++++++ ANDROID_KEYBOARD_FIX.md | 54 --------------- CLAUDE.md | 83 +++++++++++++++++++++++- README.md | 39 +++++++++++ docs/build-system.md | 11 +++- docs/spec.md | 7 +- poltergeist.config.json | 29 +++++++++ 9 files changed, 188 insertions(+), 62 deletions(-) create mode 100644 .github/workflows/run-gemini-cli.yml delete mode 100644 ANDROID_KEYBOARD_FIX.md create mode 100644 poltergeist.config.json diff --git a/.github/workflows/claude-code-review.yml b/.github/workflows/claude-code-review.yml index 4ddf8285..d55e6292 100644 --- a/.github/workflows/claude-code-review.yml +++ b/.github/workflows/claude-code-review.yml @@ -85,7 +85,7 @@ jobs: continue-on-error: true uses: anthropics/claude-code-action@beta with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # Use Claude Sonnet 4 (default model) # model: "claude-opus-4-20250514" diff --git a/.github/workflows/claude.yml b/.github/workflows/claude.yml index fd5525b5..43914fdc 100644 --- a/.github/workflows/claude.yml +++ b/.github/workflows/claude.yml @@ -38,7 +38,7 @@ jobs: id: claude uses: anthropics/claude-code-action@beta with: - anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }} + claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # Optional: Specify model (defaults to Claude Sonnet 4, uncomment for Claude Opus 4) # model: "claude-opus-4-20250514" diff --git a/.github/workflows/run-gemini-cli.yml b/.github/workflows/run-gemini-cli.yml new file mode 100644 index 00000000..c7498e9e --- /dev/null +++ b/.github/workflows/run-gemini-cli.yml @@ -0,0 +1,23 @@ +name: Run Gemini CLI + +on: + pull_request: + types: [opened, synchronize] + issue_comment: + types: [created] + workflow_dispatch: + +jobs: + run-gemini: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Gemini CLI + uses: google-github-actions/run-gemini-cli@main + with: + gemini_api_key: ${{ secrets.GEMINI_API_KEY }} + # Optional: Specify custom prompt or configuration + # prompt: "Review this code for improvements" \ No newline at end of file diff --git a/ANDROID_KEYBOARD_FIX.md b/ANDROID_KEYBOARD_FIX.md deleted file mode 100644 index 0996d0e6..00000000 --- a/ANDROID_KEYBOARD_FIX.md +++ /dev/null @@ -1,54 +0,0 @@ -# Android Keyboard Fix for Claude Code - -## Issue #504: Android keyboard covers Claude Code text input - -### Problem -When Claude Code runs inside a VibeTunnel terminal session on Android Chrome, the on-screen keyboard covers the text input area, preventing users from seeing what they're typing. - -### Root Cause -While VibeTunnel handles keyboard appearance for its own UI elements, embedded applications like Claude Code running inside the terminal don't benefit from these adjustments. The terminal content remains fixed in position when the keyboard appears. - -### Solution Implemented - -#### 1. Modern Viewport Units -- Added `100dvh` (dynamic viewport height) units alongside existing `100vh` -- Dynamic viewport units automatically adjust when the keyboard appears/disappears -- Updated in `index.html` for better mobile browser support - -#### 2. Interactive Widget Meta Tag -- Added `interactive-widget=resizes-content` to viewport meta tag -- This tells Android Chrome to resize the viewport when keyboard appears -- Provides better native handling of keyboard appearance - -#### 3. CSS Improvements -- Made terminal viewport scrollable when keyboard is visible -- Added specific styles for `data-keyboard-visible="true"` state -- Ensured xterm viewport can scroll to show content behind keyboard -- Used `env(keyboard-inset-height)` for future-proof keyboard handling - -#### 4. Enhanced Keyboard Detection -- Set CSS custom property `--keyboard-height` with actual keyboard height -- Added `data-keyboard-visible` attribute to body element -- Dispatch custom events `vibetunnel:keyboard-shown` and `vibetunnel:keyboard-hidden` -- These allow embedded apps to react to keyboard state changes - -### Benefits -- Claude Code (and other embedded apps) can now be scrolled when keyboard appears -- No more hidden input fields on Android devices -- Better visual feedback and smoother transitions -- Future-proof solution using modern CSS and viewport APIs - -### Testing -1. Open VibeTunnel on Android Chrome -2. Start a Claude Code session -3. Tap on Claude's input field -4. Verify that: - - The viewport adjusts when keyboard appears - - You can scroll to see the input field - - Text input remains visible while typing - - Keyboard dismissal restores normal view - -### Compatibility -- Android Chrome: Full support -- iOS Safari: Improved support (already had better handling) -- Desktop browsers: No impact (mobile-only styles) \ No newline at end of file diff --git a/CLAUDE.md b/CLAUDE.md index 522f9184..ff82dc3e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -14,11 +14,28 @@ VibeTunnel is a macOS application that allows users to access their terminal ses ### Building the Project -#### macOS App +#### macOS App with Poltergeist (Recommended if installed) + +If Poltergeist is installed, it will automatically rebuild the app when you make changes: + +```bash +# First, ensure Poltergeist is running in the project root +poltergeist haunt + +# The app will automatically rebuild on file changes +# Check Poltergeist menu bar app for build status +``` + +#### macOS App without Poltergeist (Fallback) + +If Poltergeist is not available, use direct Xcode builds: ```bash cd mac +# Build using xcodebuild directly +xcodebuild -project VibeTunnel.xcodeproj -scheme VibeTunnel -configuration Debug build + +# Or use the build script for release builds ./scripts/build.sh # Build release version -./scripts/build.sh --configuration Debug # Build debug version ./scripts/build.sh --sign # Build with code signing ``` @@ -268,6 +285,68 @@ The agent will: - Don't add fallbacks for older versions - If you suggest backwards compatibility in any form, you have failed to understand this project +## Poltergeist Integration + +Poltergeist is an intelligent file watcher and auto-builder that can automatically rebuild VibeTunnel when you make changes. When working on VibeTunnel development, check if Poltergeist is available and use it for automatic builds. + +### Checking for Poltergeist + +```bash +# Check if Poltergeist is installed +which poltergeist + +# Check if Poltergeist is already running for this project +ps aux | grep poltergeist | grep -v grep +``` + +### Using Poltergeist for Development + +If Poltergeist is installed: + +1. **Start Poltergeist** in the project root: + ```bash + cd /path/to/vibetunnel + poltergeist haunt + ``` + +2. **Monitor build status** via the Poltergeist menu bar app (macOS) or terminal output: + ```bash + poltergeist status + ``` + +3. **Make changes** - Poltergeist will automatically rebuild when it detects changes to: + - Swift files in `mac/` + - Xcode project files + - Configuration files + +4. **Run the app** with fresh builds using `polter`: + ```bash + polter vibetunnel # Waits for build to complete, then runs + ``` + +### Fallback Without Poltergeist + +If Poltergeist is not available, fall back to direct Xcode builds: + +```bash +# Debug build +cd mac +xcodebuild -project VibeTunnel.xcodeproj -scheme VibeTunnel -configuration Debug build + +# Release build +./scripts/build.sh +``` + +### Poltergeist Configuration + +The project includes `poltergeist.config.json` which configures: +- **vibetunnel** target: Builds the macOS app using workspace +- **vibetunnel-ios** target: Builds the iOS app (disabled by default) +- Intelligent debouncing to prevent excessive rebuilds +- Build notifications via macOS notification center + +To enable iOS builds, edit `poltergeist.config.json` and set `"enabled": true` for the vibetunnel-ios target. + ## Key Files Quick Reference - Architecture Details: `docs/ARCHITECTURE.md` diff --git a/README.md b/README.md index d4e72d95..88c16f70 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,7 @@ - [npm Package](#npm-package) - [Building from Source](#building-from-source) - [Development](#development) +- [Poltergeist Integration](#poltergeist-integration) - [Documentation](#documentation) - [macOS Permissions](#macos-permissions) - [Contributing](#contributing) @@ -916,6 +917,44 @@ VIBETUNNEL_LOG_LEVEL=silent vt npm test **Note**: All logs are always written to `~/.vibetunnel/log.txt` regardless of verbosity level. The verbosity settings only control what's displayed in the terminal. +## Poltergeist Integration + +[Poltergeist](https://github.com/poltergeist/poltergeist) is an intelligent file watcher and auto-builder that can automatically rebuild VibeTunnel as you develop. This is particularly useful for native app development where manual rebuilds can interrupt your flow. + +### Setting Up Poltergeist + +1. **Install Poltergeist** (if not already installed): + ```bash + npm install -g poltergeist + ``` + +2. **Start Poltergeist** in the VibeTunnel directory: + ```bash + cd /path/to/vibetunnel + poltergeist + ``` + +3. **Make changes** - Poltergeist will automatically rebuild when it detects changes to: + - Swift files in `mac/` or `ios/` + - Xcode project files + - Configuration files + +### Poltergeist Features + +- **Automatic Rebuilds**: Detects file changes and rebuilds instantly +- **Smart Debouncing**: Prevents excessive rebuilds during rapid edits +- **Build Notifications**: macOS notifications for build success/failure +- **Menu Bar Integration**: Monitor build status from the macOS menu bar +- **Parallel Builds**: Can build macOS and iOS targets simultaneously + +### Configuration + +VibeTunnel includes a `poltergeist.config.json` that configures: +- **vibetunnel** target: Builds the macOS app in Debug configuration +- **vibetunnel-ios** target: Builds the iOS app (disabled by default) + +To enable iOS builds, edit `poltergeist.config.json` and set `"enabled": true` for the vibetunnel-ios target. + ## Documentation - [Keyboard Shortcuts](docs/keyboard-shortcuts.md) - Complete keyboard shortcut reference diff --git a/docs/build-system.md b/docs/build-system.md index 4ad1a698..2cee9ed1 100644 --- a/docs/build-system.md +++ b/docs/build-system.md @@ -9,10 +9,17 @@ The main build orchestration happens through shell scripts in `mac/scripts/` tha ### macOS Application Build -**Development Build** - Quick build without code signing: +**Development Build with Poltergeist** (Recommended): +```bash +# Start Poltergeist for automatic rebuilds +poltergeist +# Make changes - app rebuilds automatically +``` + +**Development Build without Poltergeist**: ```bash cd mac -./scripts/build.sh --configuration Debug +xcodebuild -project VibeTunnel.xcodeproj -scheme VibeTunnel -configuration Debug build ``` **Release Build** - Full build with code signing: diff --git a/docs/spec.md b/docs/spec.md index 450c2c10..88d23844 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -718,8 +718,11 @@ cleanupOnStartup: Bool = true # Complete build cd mac && ./scripts/build.sh --configuration Release --sign -# Development build -cd mac && ./scripts/build.sh --configuration Debug +# Development build (with Poltergeist if available) +poltergeist # Automatic rebuilds on file changes + +# Or manual build +cd mac && xcodebuild -project VibeTunnel.xcodeproj -scheme VibeTunnel -configuration Debug build ``` **Build Phases**: diff --git a/poltergeist.config.json b/poltergeist.config.json new file mode 100644 index 00000000..aee77506 --- /dev/null +++ b/poltergeist.config.json @@ -0,0 +1,29 @@ +{ + "version": "1.0", + "projectType": "swift", + "targets": [ + { + "name": "vibetunnel", + "type": "app-bundle", + "buildCommand": "cd . && xcodebuild -workspace VibeTunnel.xcworkspace -scheme VibeTunnel -configuration Debug build", + "outputPath": "./mac/build/Build/Products/Debug/VibeTunnel.app", + "bundleId": "sh.vibetunnel.vibetunnel.debug", + "watchPaths": [ + "./**/*.{swift,xcconfig,entitlements,plist}", + "./**/*.xcodeproj/**" + ] + }, + { + "name": "vibetunnel-ios", + "type": "app-bundle", + "buildCommand": "cd ios && xcodebuild -project VibeTunnel-iOS.xcodeproj -scheme VibeTunnel-iOS -configuration Debug build", + "outputPath": "./ios/build/Build/Products/Debug-iphonesimulator/VibeTunnel.app", + "bundleId": "sh.vibetunnel.ios", + "watchPaths": [ + "ios/**/*.{swift,xcconfig,entitlements,plist}", + "ios/**/*.xcodeproj/**" + ], + "enabled": false + } + ] +} \ No newline at end of file