### Frontend Development Commands Source: https://github.com/duelion/homebox-companion/blob/main/AGENTS.md Commands for installing dependencies, running the development server, and performing validation/formatting checks for the frontend using npm. ```bash # Frontend (in frontend/ directory) npm install npm run dev npm run check # TypeScript/Svelte validation npm run lint # ESLint (Svelte + Tailwind) npm run lint:fix # ESLint with auto-fix npm run format:check # Prettier format check npm run format # Prettier auto-format ``` -------------------------------- ### Start Homebox Companion with Docker Compose Source: https://github.com/duelion/homebox-companion/blob/main/README.md Command to start the Homebox Companion service defined in your docker-compose.yml file in detached mode. ```bash docker compose up -d ``` -------------------------------- ### Environment Variables for Homebox Companion Source: https://github.com/duelion/homebox-companion/blob/main/AGENTS.md Example environment variables required for the Homebox Companion application. Includes API keys, model selection, and Homebox URL. ```bash HBC_LLM_API_KEY=sk-your-key # Required HBC_LLM_MODEL=gpt-5-mini # Optional (default) HBC_LLM_API_BASE=https://... # Optional, for proxies HBC_HOMEBOX_URL=https://demo.homebox.software ``` -------------------------------- ### Configure CORS Origins for Production Source: https://github.com/duelion/homebox-companion/blob/main/README.md Sets specific allowed CORS origins for production environments to enhance security. This example allows requests only from 'inventory.example.com'. ```bash # Allow only your frontend domain HBC_CORS_ORIGINS=https://inventory.example.com ``` -------------------------------- ### Docker Compose Setup for Homebox Companion Source: https://github.com/duelion/homebox-companion/blob/main/README.md This Docker Compose configuration sets up the Homebox Companion service. It requires your OpenAI API key and the URL of your Homebox instance. The service is set to restart automatically. ```yaml #docker-compose.yml services: homebox-companion: image: ghcr.io/duelion/homebox-companion:latest container_name: homebox-companion restart: always environment: - HBC_LLM_API_KEY=sk-your-api-key-here - HBC_HOMEBOX_URL=http://your-homebox-ip:7745 ports: - 8000:8000 ``` -------------------------------- ### Initiate OIDC Login Flow Source: https://github.com/duelion/homebox-companion/blob/main/tests/oidc_test.html Opens a popup window to start the OIDC login process and monitors it for completion or closure. Handles potential popup blockers. ```javascript function startOIDCFlow() { log('Opening OIDC login popup...'); const oidcUrl = `${homeboxUrl}/api/v1/users/login/oidc`; log(`Redirect URL: ${oidcUrl}`); const width = 500; const height = 600; const left = (screen.width - width) / 2; const top = (screen.height - height) / 2; oidcPopup = window.open( oidcUrl, 'HomeboxOIDC', `width=${width},height=${height},left=${left},top=${top}` ); if (!oidcPopup) { showStatus('oidcResult', '❌ Popup blocked! Please allow popups for this site.', 'error'); return; } showStatus('oidcResult', '⏳ Waiting for OIDC login... Check the popup window.', 'info'); const checkInterval = setInterval(() => { try { if (oidcPopup.closed) { clearInterval(checkInterval); log('Popup was closed'); showStatus('oidcResult', '⚠️ Popup was closed. Check the log for any captured data.', 'warning'); return; } const popupUrl = oidcPopup.location.href; log(`Popup URL: ${popupUrl}`); if (popupUrl.includes(homeboxUrl.replace('https://', '').replace('http://', ''))) { log('Detected return to Homebox domain!'); const url = new URL(popupUrl); const hashParams = new URLSearchParams(url.hash.substring(1)); const queryParams = url.searchParams; log('URL Search Params: ' + url.search); log('URL Hash: ' + url.hash); const token = hashParams.get('token') || queryParams.get('token') || hashParams.get('access_token') || queryParams.get('access_token'); if (token) { clearInterval(checkInterval); captureToken(token, 'URL Parameter'); oidcPopup.close(); } try { const cookies = oidcPopup.document.cookie; if (cookies) { log('Popup cookies: ' + cookies); } } catch (e) {} } } catch (e) {} }, 500); setTimeout(() => { clearInterval(checkInterval); if (oidcPopup && !oidcPopup.closed) { log('Timeout waiting for OIDC response'); } }, 300000); } ``` -------------------------------- ### Python Development Commands with uv Source: https://github.com/duelion/homebox-companion/blob/main/AGENTS.md Commands for managing Python dependencies and running scripts using uv. Use 'uv sync' to install, 'uv add' to add packages, and 'uv run' to execute commands within the virtual environment. ```bash # Python (use uv, not pip) uv sync # Install dependencies uv add # Add dependency uv run # Run in virtual env ``` -------------------------------- ### Frontend CSS Custom Values Example Source: https://github.com/duelion/homebox-companion/blob/main/AGENTS.md Illustrates how to use theme() function within Svelte component styles to access Tailwind CSS tokens, ensuring consistency. ```html **Canvas operations**: Use `CANVAS_COLORS` from `lib/utils/canvas-colors.ts` (synced with Tailwind tokens). **CSS custom values**: In component `