Local Development Workflow
Relevant source files
The following files were used as context for generating this wiki page:
The local development workflow for KernelForge-App enables developers to build, test, and iterate on a specialized Android kernel development dashboard. This environment provides the necessary tools for visual kernel orchestration, including automated patching, flashable ZIP generation, and AI-powered log analysis. Sources: README.md:1-12
This workflow bridges a Next.js 15 web framework with a Capacitor 6 native bridge to support a locally installable Android app. Developers interact with the system through a web interface that simulates the kernel build process and prepares static exports for the mobile application. Sources: README.md:14-22, package.json:34-35, package.json:84-85
Environment Setup and Execution
To start the local development environment, you must use the scripts defined in the project configuration. The primary entry point is a browser-based development layout.
Available Development Scripts
| Script | Command | Description |
|---|---|---|
dev | next dev --turbopack -p 9002 | Starts the browser-based development layout on port 9002 using Turbopack. |
genkit:dev | genkit start -- tsx src/ai/dev.ts | Launches the Genkit development environment for AI feature testing. |
genkit:watch | genkit start -- tsx --watch src/ai/dev.ts | Launches Genkit with file watching enabled. |
build:static | next build | Compiles the Next.js static payload for mobile deployment. |
cap:sync | npx cap sync | Synchronizes the web assets with the Capacitor native bridge. |
Sources: package.json:7-14, README.md:25-26
Project Initialization Flow
The following diagram illustrates the sequence for initializing the local development environment and preparing it for native deployment.
This flow ensures that changes made in the web framework are correctly compiled and synchronized with the Capacitor wrapper before deployment to mobile hardware. Sources: package.json:7-13, README.md:28-36
Development Guidelines
When contributing to the local environment, you must adhere to established standards for code style and platform compatibility.
Writing and Coding Standards
- Voice: Use the second person ("you") and active voice in documentation.
- Clarity: Prioritize clarity and simplicity over complex grammatical structures.
- Platform Specifics: When writing scripts, prefer TypeScript over Bash to ensure compatibility for Windows developers.
- Windows Support: Use
\r?\nin Regular Expressions andpath.posixfor URLs to support cross-platform development.
Sources: CONTRIBUTING.md:50-68, CONTRIBUTING.md:120-134
AI Module Integration
Local development includes a specialized workflow for the AI Troubleshooting Assistant. Because the application is designed for static export as an APK, the local development environment uses mock responses for AI analysis unless a remote endpoint is provided. Sources: src/ai/flows/ai-build-troubleshooting-assistant.ts:1-5
AI Flow Architecture
The AI Troubleshooting Assistant expects a specific data structure for inputs and outputs during development.
- Input Schema: Contains
buildLog(string) and optionaldeviceInfo(object containing model, codename, GKI, and KMI versions). - Output Schema: Returns
summary(string),identifiedErrors(array), andsuggestedSolutions(array).
Sources: src/ai/flows/ai-build-troubleshooting-assistant.ts:7-30, src/components/dashboard/AITroubleshooter.tsx:18-28
Build and Packaging Simulation
Developers use the dashboard tab in the local UI to simulate the kernel compilation process. This allows for testing the UI feedback loops without requiring a full Linux kernel toolchain during frontend development. Sources: src/app/page.tsx:78-83
Compilation Simulation Logic
- State Initialization: The
startBuildfunction resets progress and logs while initializing target parameters like device model and GKI version. - Progress Tracking: A
useEffecthook simulates progress increments (random 1-5%) every 500ms. - Dynamic Logging: Logs are generated at specific progress milestones (e.g., 25% for TCP BBR, 40% for NoMount).
- Artifact Generation: Upon reaching 100%, the system enables buttons for
Download ImageandGenerate ZIP.
Sources: src/app/page.tsx:85-112, src/app/page.tsx:143-169
Summary
The local development workflow for KernelForge-App provides a Next.js environment for developing mobile-native kernel management tools. It leverages Turbopack for rapid iteration and Genkit for AI module development. Developers follow a structured path from web-based feature implementation to Capacitor synchronization, ensuring all kernel patching and packaging features function correctly before the automated GitHub Actions CI/CD pipeline builds the final APK. Sources: README.md:28-36, package.json:7-14