First working POC

This commit is contained in:
2026-01-26 22:21:54 +01:00
commit cfddc1edea
255 changed files with 77606 additions and 0 deletions
+82
View File
@@ -0,0 +1,82 @@
# Development Scripts
Collection of utility scripts for building, testing, and deploying JellyTau.
## Testing Scripts
### `test-all.sh`
Run all tests (frontend + Rust backend).
```bash
./scripts/test-all.sh
```
### `test-frontend.sh`
Run frontend tests only.
```bash
./scripts/test-frontend.sh # Run all tests
./scripts/test-frontend.sh --watch # Watch mode
./scripts/test-frontend.sh --ui # Open UI
```
### `test-rust.sh`
Run Rust tests only.
```bash
./scripts/test-rust.sh # Run all tests
./scripts/test-rust.sh -- --nocapture # Show println! output
```
## Android Scripts
### `build-android.sh`
Build the Android APK.
```bash
./scripts/build-android.sh # Debug build
./scripts/build-android.sh release # Release build
```
### `deploy-android.sh`
Install APK on connected Android device.
```bash
./scripts/deploy-android.sh # Deploy debug APK
./scripts/deploy-android.sh release # Deploy release APK
```
### `build-and-deploy.sh`
Build and deploy in one command.
```bash
./scripts/build-and-deploy.sh # Build + deploy debug
./scripts/build-and-deploy.sh release # Build + deploy release
```
### `check-android.sh`
Check Android development environment setup.
```bash
./scripts/check-android.sh
```
### `logcat.sh`
View Android logcat filtered for the app.
```bash
./scripts/logcat.sh
```
## Utility Scripts
### `clean.sh`
Clean all build artifacts.
```bash
./scripts/clean.sh
```
## NPM Script Aliases
You can also run these via npm/bun:
```bash
bun run test:all # All tests
bun run test:rust # Rust tests
bun run android:build # Build Android APK
bun run android:deploy # Deploy to device
bun run android:dev # Build + deploy debug
bun run android:check # Check environment
bun run clean # Clean artifacts
```
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
# Build and deploy Android APK in one command
set -e
BUILD_TYPE="${1:-debug}"
echo "🚀 Build and Deploy Android APK"
echo ""
# Build APK
./scripts/build-android.sh "$BUILD_TYPE"
echo ""
# Deploy APK
./scripts/deploy-android.sh "$BUILD_TYPE"
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# Build Android APK
set -e
# Source Rust environment
source "$HOME/.cargo/env.fish" 2>/dev/null || source "$HOME/.cargo/env" 2>/dev/null || true
# Set Android environment variables
export ANDROID_HOME="$HOME/Android/Sdk"
export NDK_HOME="$ANDROID_HOME/ndk/$(ls "$ANDROID_HOME/ndk" | head -1)"
echo "🤖 Building Android APK..."
echo "Android SDK: $ANDROID_HOME"
echo "NDK: $NDK_HOME"
echo ""
# Build type: debug or release (default: debug)
BUILD_TYPE="${1:-debug}"
# Step 1: Sync Android source files
echo "🔄 Syncing Android sources..."
./scripts/sync-android-sources.sh
# Step 2: Build the frontend first to avoid dev server issues
echo "🎨 Building frontend..."
bun run build
# Step 2: Build Android APK
if [ "$BUILD_TYPE" = "release" ]; then
echo "📦 Building release APK..."
bun run tauri android build --apk true
else
echo "📦 Building debug APK..."
bun run tauri android build --apk true --debug
fi
echo ""
echo "✅ APK build complete!"
echo "📱 APK location: src-tauri/gen/android/app/build/outputs/apk/"
+55
View File
@@ -0,0 +1,55 @@
#!/bin/bash
# Check Android development environment
set -e
echo "🔍 Checking Android development environment..."
echo ""
# Check ADB
if command -v adb &> /dev/null; then
echo "✅ ADB installed: $(adb version | head -1)"
else
echo "❌ ADB not found"
fi
# Check Android SDK
if [ -d "$HOME/Android/Sdk" ]; then
echo "✅ Android SDK found at: $HOME/Android/Sdk"
else
echo "❌ Android SDK not found at: $HOME/Android/Sdk"
fi
# Check NDK
if [ -d "$HOME/Android/Sdk/ndk" ]; then
NDK_VERSION=$(ls "$HOME/Android/Sdk/ndk" | head -1)
echo "✅ NDK found: $NDK_VERSION"
else
echo "❌ NDK not found"
fi
# Check Rust
if command -v rustc &> /dev/null; then
echo "✅ Rust installed: $(rustc --version)"
else
echo "❌ Rust not found"
fi
# Check Cargo
if command -v cargo &> /dev/null; then
echo "✅ Cargo installed: $(cargo --version)"
else
echo "❌ Cargo not found"
fi
# Check for connected devices
echo ""
echo "📱 Connected Android devices:"
if adb devices | grep -q "device$"; then
adb devices | grep "device$"
else
echo "⚠️ No devices connected"
fi
echo ""
echo "🔍 Environment check complete!"
+84
View File
@@ -0,0 +1,84 @@
#!/bin/bash
#
# Requirements Coverage Checker
# Extracts @req tags from codebase and compares with README.md
#
set -e
REQUIREMENTS_FILE="README.md"
SOURCE_DIRS="src-tauri/ src/"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Requirements Coverage Report"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Extract requirement IDs from README.md (UR-, IR-, DR-, JA-)
echo "📊 Scanning requirements from $REQUIREMENTS_FILE..."
requirements=$(grep -E "^\| (UR|IR|DR|JA)-[0-9]+" "$REQUIREMENTS_FILE" | \
sed -E 's/^\| ([A-Z]+-[0-9]+).*/\1/' | \
sort -u)
total_reqs=$(echo "$requirements" | wc -l)
implemented=0
partial=0
planned=0
missing=0
echo ""
echo "Category Breakdown:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
for category in UR IR DR JA; do
cat_count=$(echo "$requirements" | grep "^$category-" | wc -l)
printf "%-4s %3d requirements\n" "$category:" "$cat_count"
done
echo ""
echo "Implementation Status:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
for req in $requirements; do
# Count full implementations
full_count=$(grep -r "@req: $req" $SOURCE_DIRS 2>/dev/null | grep -v "@req-partial" | grep -v "@req-planned" | wc -l)
# Count partial implementations
partial_count=$(grep -r "@req-partial: $req" $SOURCE_DIRS 2>/dev/null | wc -l)
# Count planned
planned_count=$(grep -r "@req-planned: $req" $SOURCE_DIRS 2>/dev/null | wc -l)
if [ "$full_count" -gt 0 ]; then
echo "$req: $full_count implementation(s)"
((implemented++))
elif [ "$partial_count" -gt 0 ]; then
echo "🔶 $req: $partial_count partial implementation(s)"
((partial++))
elif [ "$planned_count" -gt 0 ]; then
echo "📋 $req: Planned (not yet implemented)"
((planned++))
else
echo "$req: No implementation found"
((missing++))
fi
done
echo ""
echo "Summary:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
printf "Total Requirements: %3d\n" "$total_reqs"
printf "✅ Fully Implemented: %3d (%.0f%%)\n" "$implemented" "$(echo "scale=0; $implemented * 100 / $total_reqs" | bc)"
printf "🔶 Partially Implemented: %3d (%.0f%%)\n" "$partial" "$(echo "scale=0; $partial * 100 / $total_reqs" | bc)"
printf "📋 Planned: %3d (%.0f%%)\n" "$planned" "$(echo "scale=0; $planned * 100 / $total_reqs" | bc)"
printf "❌ Missing: %3d (%.0f%%)\n" "$missing" "$(echo "scale=0; $missing * 100 / $total_reqs" | bc)"
echo ""
# Exit code based on missing critical requirements
if [ "$missing" -gt 0 ]; then
echo "⚠️ Warning: $missing requirements have no implementation"
exit 1
else
echo "✨ All requirements have implementations!"
exit 0
fi
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
#
# Test Coverage Report
# Links test requirements to implementations
#
echo "Test Coverage Report"
echo "===================="
echo ""
test_reqs=$(grep -rh "@req-test:" src-tauri/ 2>/dev/null | \
sed 's/.*@req-test: \([A-Z][A-Z]-[0-9]*\).*/\1/' | \
sort -u)
total_tests=0
covered=0
uncovered=0
for req in $test_reqs; do
test_count=$(grep -r "@req-test: $req" src-tauri/ 2>/dev/null | wc -l)
impl_count=$(grep -r "@req: $req" src-tauri/ src/ 2>/dev/null | wc -l)
((total_tests++))
if [ "$test_count" -gt 0 ] && [ "$impl_count" -gt 0 ]; then
echo "$req: $test_count test(s), $impl_count implementation(s)"
((covered++))
elif [ "$impl_count" -eq 0 ]; then
echo "⚠️ $req: $test_count test(s) but no implementation"
((uncovered++))
fi
done
echo ""
echo "Summary:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
printf "Total Test Requirements: %3d\n" "$total_tests"
printf "✅ With Implementation: %3d (%.0f%%)\n" "$covered" "$(echo "scale=0; $covered * 100 / $total_tests" | bc)"
printf "⚠️ No Implementation: %3d (%.0f%%)\n" "$uncovered" "$(echo "scale=0; $uncovered * 100 / $total_tests" | bc)"
echo ""
+40
View File
@@ -0,0 +1,40 @@
#!/bin/bash
# Clean build artifacts
set -e
echo "🧹 Cleaning build artifacts..."
echo ""
# Clean frontend
if [ -d "node_modules/.cache" ]; then
echo "Cleaning Vite cache..."
rm -rf node_modules/.cache
fi
if [ -d ".svelte-kit" ]; then
echo "Cleaning SvelteKit build..."
rm -rf .svelte-kit
fi
if [ -d "build" ]; then
echo "Cleaning build directory..."
rm -rf build
fi
# Clean Rust
echo "Cleaning Rust target..."
cd src-tauri
cargo clean
cd ..
# Clean Android
if [ -d "src-tauri/gen/android" ]; then
echo "Cleaning Android build..."
cd src-tauri/gen/android
./gradlew clean 2>/dev/null || true
cd ../../..
fi
echo ""
echo "✅ Clean complete!"
+37
View File
@@ -0,0 +1,37 @@
#!/bin/bash
# Deploy APK to connected Android device
set -e
echo "📱 Deploying to Android device..."
echo ""
# Check if device is connected
if ! adb devices | grep -q "device$"; then
echo "❌ No Android device connected!"
echo "Please connect a device or start an emulator."
exit 1
fi
# Build type: debug or release (default: debug)
BUILD_TYPE="${1:-debug}"
if [ "$BUILD_TYPE" = "release" ]; then
APK_PATH="src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk"
else
APK_PATH="src-tauri/gen/android/app/build/outputs/apk/universal/debug/app-universal-debug.apk"
fi
# Check if APK exists
if [ ! -f "$APK_PATH" ]; then
echo "❌ APK not found at: $APK_PATH"
echo "Run './scripts/build-android.sh $BUILD_TYPE' first"
exit 1
fi
echo "📦 Installing APK: $APK_PATH"
adb install -r "$APK_PATH"
echo ""
echo "✅ Deployment complete!"
echo "🚀 Launch the app on your device"
+56
View File
@@ -0,0 +1,56 @@
#!/bin/bash
#
# Find all files implementing a specific requirement
#
# Usage: ./find-req-implementations.sh UR-004
#
if [ $# -eq 0 ]; then
echo "Usage: $0 <REQUIREMENT_ID>"
echo "Example: $0 UR-004"
exit 1
fi
REQ_ID=$1
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo " Implementations of $REQ_ID"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
# Full implementations
echo "Full Implementations:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
grep -rn "@req: $REQ_ID" src-tauri/ src/ 2>/dev/null | \
grep -v "@req-partial" | \
grep -v "@req-planned" | \
sed 's/src-tauri\/src\///' | \
sed 's/src\///' || echo " (none)"
echo ""
# Partial implementations
echo "Partial Implementations:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
grep -rn "@req-partial: $REQ_ID" src-tauri/ src/ 2>/dev/null | \
sed 's/src-tauri\/src\///' | \
sed 's/src\///' || echo " (none)"
echo ""
# Planned
echo "Planned Implementations:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
grep -rn "@req-planned: $REQ_ID" src-tauri/ src/ 2>/dev/null | \
sed 's/src-tauri\/src\///' | \
sed 's/src\///' || echo " (none)"
echo ""
# Tests
echo "Test Cases:"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
grep -rn "@req-test: $REQ_ID" src-tauri/ 2>/dev/null | \
sed 's/src-tauri\/src\///' || echo " (none)"
echo ""
+38
View File
@@ -0,0 +1,38 @@
#!/bin/bash
#
# Generate traceability matrix in Markdown format
#
echo "# Requirements Traceability Matrix"
echo ""
echo "**Generated**: $(date '+%Y-%m-%d %H:%M:%S')"
echo ""
echo "| Requirement | Files Implementing | Status | Notes |"
echo "|-------------|--------------------|--------|-------|"
requirements=$(grep -E "^\| (UR|IR|DR|JA)-[0-9]+" README.md | sed -E 's/^\| ([A-Z]+-[0-9]+).*/\1/' | sort -u)
for req in $requirements; do
files=$(grep -rl "@req: $req" src-tauri/ src/ 2>/dev/null | \
sed 's|src-tauri/src/||; s|src/||' | \
paste -sd, -)
partial_files=$(grep -rl "@req-partial: $req" src-tauri/ src/ 2>/dev/null | wc -l)
planned=$(grep -rl "@req-planned: $req" src-tauri/ src/ 2>/dev/null | wc -l)
if [ -n "$files" ]; then
status="✅ Done"
notes=""
elif [ "$partial_files" -gt 0 ]; then
status="🔶 Partial"
notes="Platform-specific"
elif [ "$planned" -gt 0 ]; then
status="📋 Planned"
notes="Not implemented"
else
status="❌ Missing"
notes="No implementation"
fi
echo "| $req | ${files:-N/A} | $status | $notes |"
done
+13
View File
@@ -0,0 +1,13 @@
#!/bin/bash
# View Android logcat output filtered for the app
set -e
APP_PACKAGE="com.jellytau.app"
echo "📱 Showing logcat for $APP_PACKAGE"
echo "Press Ctrl+C to stop"
echo ""
# Filter logcat for the app's package name
adb logcat | grep -i "$APP_PACKAGE\|tauri\|rust"
+34
View File
@@ -0,0 +1,34 @@
#!/bin/bash
# Sync Android source files from src-tauri/android to src-tauri/gen/android
# This ensures the generated build directory has the latest source files
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
SOURCE_DIR="$PROJECT_ROOT/src-tauri/android/src/main/java/com/dtourolle/jellytau"
TARGET_DIR="$PROJECT_ROOT/src-tauri/gen/android/app/src/main/java/com/dtourolle/jellytau"
echo "Syncing Android sources..."
echo " From: $SOURCE_DIR"
echo " To: $TARGET_DIR"
# Create target directory if it doesn't exist
mkdir -p "$TARGET_DIR"
# Remove old copies of player and security directories
rm -rf "$TARGET_DIR/player" "$TARGET_DIR/security"
# Copy the directories
cp -r "$SOURCE_DIR/player" "$TARGET_DIR/"
cp -r "$SOURCE_DIR/security" "$TARGET_DIR/"
# Copy individual Kotlin files (like VideoOverlayManager.kt)
for kt_file in "$SOURCE_DIR"/*.kt; do
if [ -f "$kt_file" ]; then
cp "$kt_file" "$TARGET_DIR/"
echo " Copied: $(basename "$kt_file")"
fi
done
echo "✓ Android sources synced successfully"
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
# Run all tests (frontend and backend)
set -e
echo "🧪 Running all tests..."
echo ""
echo "📦 Running frontend tests..."
bun test
echo ""
echo "🦀 Running Rust tests..."
cd src-tauri
cargo test
cd ..
echo ""
echo "✅ All tests passed!"
+7
View File
@@ -0,0 +1,7 @@
#!/bin/bash
# Run frontend tests only
set -e
echo "📦 Running frontend tests..."
bun test "$@"
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash
# Run Rust tests only
set -e
echo "🦀 Running Rust tests..."
cd src-tauri
cargo test "$@"
cd ..