refactor: retire old entry points, delegate to CLI

This commit is contained in:
William Valentin
2026-02-05 22:18:16 -08:00
parent 1ed9a34715
commit 826e217dce
2 changed files with 8 additions and 262 deletions
+2 -36
View File
@@ -1,36 +1,2 @@
import { loadConfig } from './config/index.js';
import { startDaemon } from './daemon/index.js';
import { resolve } from 'path';
import { homedir } from 'os';
import { existsSync } from 'fs';
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}`);
if (!existsSync(CONFIG_PATH)) {
console.error(`Config file not found: ${CONFIG_PATH}`);
console.error('Copy config/default.yaml to ~/.config/flynn/config.yaml and configure it.');
process.exit(1);
}
try {
const config = loadConfig(CONFIG_PATH);
const daemon = await startDaemon(config);
console.log(`Allowed Telegram chat IDs: ${config.telegram.allowed_chat_ids.join(', ')}`);
// 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();
// Legacy entry point — delegates to CLI
import './cli/index.js';