System Health Diagnostic Center
Relevant source files
The following files were used as context for generating this wiki page:
The System Health Diagnostic Center is a critical subsystem within Keynobi designed to monitor and validate the development environment required for Android development. It ensures that essential tools—such as the Android SDK, Java JDK, ADB, and the Android Emulator—are correctly configured and accessible. By providing real-time feedback and actionable "fix" links, it reduces the friction of setting up a functional Android build environment.
The system operates through a combination of active probes executed by the Rust backend and reactive derivations from frontend state. It serves as a centralized hub for troubleshooting environment issues, offering diagnostic reports that can be accessed via the HealthPanel, StatusBar, or during the initial OnboardingWizard.
Sources: src/stores/health.store.ts:1-15, src/components/health/HealthPanel.tsx:505-530, README.md
Architectural Overview
The Diagnostic Center follows a decoupled architecture where the Rust backend performs low-level system introspection while the frontend manages reactivity and user interaction.
Data Flow and Interaction
The system relies on the run_health_checks Tauri command to gather data that requires process execution or filesystem access. This data is then merged with reactive state (like user settings) in the frontend store to produce a comprehensive health report.
The diagram shows the sequence from a user-initiated refresh to the backend probing and final UI update.
Sources: src/stores/health.store.ts:40-60, src/lib/tauri-api.ts:85-90, src/components/health/HealthPanel.tsx:510-520
Health Store and State Management
The health.store.ts manages the lifecycle of health checks. It maintains the current systemReport, the running status of checks, and the timestamp of the last verification.
Core Data Structures
The system uses several TypeScript types to represent check states:
| Type | Description | Values |
|---|---|---|
CheckStatus | The status of an individual check. | ok, warning, error, loading, skip |
OverallHealth | The aggregate state of the entire system. | ok, warning, error, loading |
HealthCheck | Metadata and status for a specific probe. | id, category, name, status, detail, fix |
Sources: src/stores/health.store.ts:21-36
Reactive Logic
The store uses createMemo to combine static configuration, user settings, and the backend report into a list of healthChecks. For example, the Android SDK check status is derived from both the user-configured sdkPath and the backend's androidSdkValid flag.
// Example of reactive status derivation
status: !sdkPath
? "error"
: sdkValid === false
? "warning"
: sdkValid === true
? "ok"
: "loading"
Sources: src/stores/health.store.ts:80-104
System Probes (Backend)
The backend probes are encapsulated in the SystemHealthReport structure. These probes verify the existence and versioning of external binaries.
| Probe Field | Tool Monitored | Verification Logic |
|---|---|---|
javaExecutableFound | Java JDK | Success of java -version. |
androidSdkValid | Android SDK | Recognizable SDK folder structure. |
adbFound | ADB | Presence in platform-tools or system PATH. |
emulatorFound | Emulator | Presence in $ANDROID_HOME/emulator/. |
studioCommandFound | Android Studio CLI | Availability of studio command on PATH. |
lspSystemDirOk | App Directory | Writable status of ~/.keynobi. |
Sources: src/bindings/SystemHealthReport.ts:8-55
Integration Points
Status Bar Integration
The StatusBar component provides a persistent, low-profile summary of system health. It uses a color-coded dot and a "checks passing" ratio (e.g., 4/5) to signal health status.
- Green: All systems operational.
- Yellow: Warnings or loading.
- Red: Error detected (e.g., missing SDK).
Sources: src/components/layout/StatusBar.tsx:28-55
Onboarding Workflow
During the first launch, the OnboardingWizard utilizes the health checks to guide the user through environment setup. It specifically highlights issues with the Android SDK and Java JDK paths, allowing users to fix them before proceeding.
Specialized Diagnostic Sections
Claude Code Integration (MCP)
The Diagnostic Center includes a dedicated section for Model Context Protocol (MCP) setup. It monitors if the claude CLI is installed and provides a one-click configuration button to register Keynobi as an MCP server.
- Auto-Configuration: Calls
configureMcpInClaudeto register the binary path. - Manual Fallback: Provides a copy-pasteable command:
claude mcp add --transport stdio keynobi -- "[exePath]" --mcp.
Sources: src/components/health/HealthPanel.tsx:238-340, src/lib/tauri-api.ts:470-485
Logcat Buffer Monitoring
A warning is displayed if the Android device's Logcat ring buffer usage exceeds 80%. This prevents silent data loss by alerting the user that oldest entries may be evicted.
Sources: src/components/health/HealthPanel.tsx:442-465
Summary
The System Health Diagnostic Center acts as a proactive guardian of the developer's environment. By surfacing complex binary dependencies (Java, SDK, ADB) into a unified UI with actionable fixes, it ensures that Keynobi remains functional and that AI agents (via MCP) have a stable environment to operate in.
Sources: README.md, src/stores/health.store.ts:160-175