#!/bin/bash echo "๐Ÿงช Meteor Edge Client Integration Demo" echo "=====================================" # Build the project first echo "๐Ÿ“ฆ Building the edge client..." cargo build --release if [ $? -ne 0 ]; then echo "โŒ Build failed!" exit 1 fi echo "โœ… Build successful!" echo "" # Test version command echo "๐Ÿ“‹ Testing version command:" ./target/release/meteor-edge-client version echo "" # Test status command (should show not registered) echo "๐Ÿ“Š Testing status command (before registration):" ./target/release/meteor-edge-client status echo "" # Test help command echo "๐Ÿ“– Testing help command:" ./target/release/meteor-edge-client --help echo "" # Test register command help echo "๐Ÿ“– Testing register command help:" ./target/release/meteor-edge-client register --help echo "" # Demonstrate what would happen with invalid token echo "๐Ÿšซ Testing registration with invalid token (should fail gracefully):" echo " Command: ./target/release/meteor-edge-client register 'invalid_jwt_token'" ./target/release/meteor-edge-client register 'invalid_jwt_token' 2>&1 || echo " โœ… Failed as expected - invalid token was rejected" echo "" # Show what a valid registration would look like echo "๐Ÿ’ก Example of successful registration (with valid backend and JWT):" echo " 1. Start backend: cd meteor-web-backend && npm run start" echo " 2. Register user: curl -X POST http://localhost:3000/api/v1/auth/register-email \\" echo " -H 'Content-Type: application/json' \\" echo " -d '{\"email\":\"test@example.com\",\"password\":\"TestPass123\",\"displayName\":\"Test User\"}'" echo " 3. Login to get JWT: curl -X POST http://localhost:3000/api/v1/auth/login-email \\" echo " -H 'Content-Type: application/json' \\" echo " -d '{\"email\":\"test@example.com\",\"password\":\"TestPass123\"}'" echo " 4. Add device to inventory: psql -d meteor_dev -c \\" echo " \"INSERT INTO inventory_devices (hardware_id, device_model) VALUES ('DEMO_DEVICE_001', 'Demo Device v1.0');\"" echo " 5. Register device: ./target/release/meteor-edge-client register " echo "" echo "๐ŸŽฏ Story 1.9 Implementation Complete!" echo "=======================================" echo "โœ… Hardware ID reading from /proc/cpuinfo (with fallbacks)" echo "โœ… CLI register subcommand with JWT token parameter" echo "โœ… HTTP API client with proper authentication headers" echo "โœ… Configuration file persistence in TOML format" echo "โœ… Startup-time registration check logic" echo "โœ… Comprehensive error handling and user feedback" echo "โœ… Unit tests for all core functionality" echo "" echo "๐Ÿ“ Key Files Created:" echo " - src/main.rs - Main CLI application with subcommands" echo " - src/hardware.rs - Hardware ID extraction logic" echo " - src/api.rs - HTTP client for device registration API" echo " - src/config.rs - Configuration file management" echo " - Cargo.toml - Dependencies and project configuration" echo "" echo "๐Ÿš€ Ready for deployment to edge devices!"