feat: auto-initialize config files on Electron app startup

Ensure models.json, mcp.json, and security.json config files are created
when the app starts, before the Settings UI can access them.

- Add ensureConfig() method to IModelConfigRepo and IMcpConfigRepo interfaces
- Add async ensureSecurityConfig() function for security config initialization
- Create initConfigs.ts with centralized initialization that calls all config ensure methods
- Call initConfigs() in main.ts before setupIpcHandlers()

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ramnique Singh 2026-01-29 16:17:51 +05:30
parent 7a59b28651
commit f5cc803340
6 changed files with 56 additions and 15 deletions

View file

@ -10,6 +10,7 @@ import { init as initFirefliesSync } from "@x/core/dist/knowledge/sync_fireflies
import { init as initGranolaSync } from "@x/core/dist/knowledge/granola/sync.js";
import { init as initGraphBuilder } from "@x/core/dist/knowledge/build_graph.js";
import { init as initPreBuiltRunner } from "@x/core/dist/pre_built/runner.js";
import { initConfigs } from "@x/core/dist/config/initConfigs.js";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
@ -96,7 +97,7 @@ function createWindow() {
}
}
app.whenReady().then(() => {
app.whenReady().then(async () => {
// Register custom protocol before creating window (for production builds)
if (app.isPackaged) {
registerAppProtocol();
@ -113,6 +114,9 @@ app.whenReady().then(() => {
});
}
// Initialize all config files before UI can access them
await initConfigs();
setupIpcHandlers();
createWindow();