Files
zesdex/src/interfaces/tui/run.ts
T

22 lines
808 B
TypeScript
Raw Normal View History

#!/usr/bin/env bun
/**
* Zesdex TUI — OpenTUI entry point.
*
* Boots the OpenTUI CLI renderer and mounts `ZesdexApp`, which routes input
* through `handleKey` → `applyAction`. Replaced the earlier raw-mode stdin
* event loop with OpenTUI's native renderer/keyboard handling.
*/
import * as fs from "node:fs";
import { createTuiState } from "./state.ts";
import { bootTui } from "./ui.tsx";
/** Run the interactive OpenTUI until the user quits. */
export async function runTui(): Promise<void> {
const cwd = process.cwd();
const dataDir = `${process.env.HOME ?? ""}/.local/share/zesdex`;
const sessionDir = `${dataDir}/sessions/${Date.now()}`;
fs.mkdirSync(sessionDir, { recursive: true });
const state = createTuiState([cwd], sessionDir, `${dataDir}/memory`);
await bootTui(state);
}