feat: add daemon skeleton with lifecycle management

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
William Valentin
2026-02-02 20:56:45 -08:00
parent 4adf172c25
commit 70c3960527
4 changed files with 133 additions and 1 deletions
+30 -1
View File
@@ -1 +1,30 @@
console.log('Flynn starting...');
import { loadConfig } from './config/index.js';
import { startDaemon } from './daemon/index.js';
import { resolve } from 'path';
import { homedir } from 'os';
const CONFIG_PATH = process.env.FLYNN_CONFIG
?? resolve(homedir(), '.config/flynn/config.yaml');
async function main() {
console.log('Flynn starting...');
console.log(`Loading config from: ${CONFIG_PATH}`);
try {
const config = loadConfig(CONFIG_PATH);
const daemon = await startDaemon(config);
console.log(`Telegram bot configured for chat IDs: ${config.telegram.allowed_chat_ids.join(', ')}`);
console.log(`Server port: ${config.server.port}`);
// Keep process alive
await new Promise<void>((resolve) => {
daemon.lifecycle.onShutdown(async () => resolve());
});
} catch (error) {
console.error('Failed to start Flynn:', error);
process.exit(1);
}
}
main();