2026-09-02 22:18:35 +07:00
|
|
|
#!/usr/bin/env bun
|
|
|
|
|
/**
|
2026-09-03 00:10:01 +07:00
|
|
|
* Zesdex TUI — OpenTUI entry point.
|
2026-09-02 22:18:35 +07:00
|
|
|
*
|
2026-09-03 00:10:01 +07:00
|
|
|
* 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.
|
2026-09-02 22:18:35 +07:00
|
|
|
*/
|
|
|
|
|
import * as fs from "node:fs";
|
2026-09-03 00:10:01 +07:00
|
|
|
import { createTuiState } from "./state.ts";
|
|
|
|
|
import { bootTui } from "./ui.tsx";
|
2026-09-02 22:18:35 +07:00
|
|
|
|
2026-09-03 00:10:01 +07:00
|
|
|
/** Run the interactive OpenTUI until the user quits. */
|
2026-09-02 22:18:35 +07:00
|
|
|
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`);
|
2026-09-03 00:10:01 +07:00
|
|
|
await bootTui(state);
|
2026-09-02 22:18:35 +07:00
|
|
|
}
|