home / skills / dbobkov245-source / pwa-torserve / debug-remote
This skill helps you debug TV apps remotely by collecting logs and telemetry from the TV environment for faster fixes.
npx playbooks add skill dbobkov245-source/pwa-torserve --skill debug-remoteReview the files below or copy the command above to add this skill to your agents.
---
name: debug-remote
description: Specialist in debugging TV apps remotely (logs, telemetry).
---
# Remote Debugging for TV
Debugging a TV app is hard. `console.log` is invisible on the TV screen.
Use this skill to capture logs and errors from the TV environment.
## 📡 Remote Logging Strategy
### 1. The "On-Screen Console" Overlay
For quick debugging without a laptop connection.
- **Trigger:** Konami Code (Up, Up, Down, Down, Left, Right, Left, Right, B, A) or hidden button.
- **UI:** A simple fixed-position `<div>` with `overflow-y: scroll`, semi-transparent background, high contrast text.
```javascript
/* Simple Logger Utility */
const originalLog = console.log;
console.log = (...args) => {
originalLog(...args);
if (window.debugOverlay) {
window.debugOverlay.innerHTML += `<div>${args.join(' ')}</div>`;
}
};
```
### 2. Network Logging (Remote Spy)
Send logs to a remote server or simple webhook (e.g., `webhook.site` for temp debugging).
```javascript
const LOG_ENDPOINT = 'https://your-log-drain.com/ingest';
function remoteLog(level, message) {
fetch(LOG_ENDPOINT, {
method: 'POST',
body: JSON.stringify({ level, message, timestamp: Date.now() })
}).catch(() => {}); // Fire and forget
}
```
### 3. ADB Logcat (The Gold Standard)
If you have ADB access:
- **Command:** `adb logcat | grep "Chromium"`
- **Filter:** Use a unique prefix in your logs: `console.log("[PWA]", ...)` -> `grep "\[PWA\]"`
## 🐛 Common TV Bugs to Watch
- **Focus Traps:** Focus goes to an invisible element or gets stuck.
- **Memory Leaks:** Large images not being garbage collected. Monitor heap size if possible.
- **Network Timeouts:** TV WiFi is often worse than phone WiFi.
- **Clock Skew:** TV system time might be wrong (SSL errors).
## 🛠 Usage
Implements a global `window.__DEBUG__` object to toggle modes:
- `window.__DEBUG__.enableOverlay()`
- `window.__DEBUG__.disableOverlay()`
- `window.__DEBUG__.setRemoteServer(url)`
This skill helps you capture and inspect logs, errors, and telemetry from TV apps remotely. It focuses on practical tools for on-screen logging, network-forwarding of logs, and leveraging ADB logcat when available. The goal is fast reproduction and diagnosis of platform-specific issues that are invisible on TV screens.
It injects a lightweight on-screen console overlay that surfaces console output directly on the TV and provides a remote logging option to forward events to a webhook or log drain. When ADB is available, it recommends filtered logcat usage and a unique log prefix to extract relevant lines. A global debug object lets you toggle overlay and configure the remote endpoint at runtime.
How do I enable the overlay without changing production code?
Expose a runtime toggle in the global debug object and ship the overlay code behind a feature flag so it can be activated via a remote config or hidden input sequence.
Is remote log forwarding secure?
Use HTTPS endpoints, authenticate log drains when possible, and avoid sending PII. For temporary debugging, use ephemeral webhooks but rotate or disable them afterward.