/** * @fusion/tui — Terminal UI components for fn * * This package provides Ink-based React components for building terminal * user interfaces that interact with Fusion task management. */ // Re-export FusionContext components and hooks export { FusionProvider, useFusion, FusionContext } from "./fusion-context.js"; export type { FusionContextValue, FusionProviderProps } from "./fusion-context.js"; // Re-export project detection utility export { detectProjectDir } from "./project-detect.js"; // Re-export components export { ScreenRouter, SCREENS, getScreenById, getScreenIndex, type ScreenId, type Screen, type ScreenRouterProps, type ScreenComponentProps, } from "./components/screen-router.js"; export { ResponsiveHeader, ResponsiveTable, ResponsiveTaskRow, ResponsiveStatusBar, type TableColumn, type ResponsiveTableProps, type ResponsiveTaskRowProps, } from "./components/responsive-layout.js"; // Re-export global shortcuts hooks export { useGlobalShortcuts, HelpOverlay, FocusGuardRef, type UseGlobalShortcutsOptions, type UseGlobalShortcutsResult, type HelpOverlayProps, } from "./hooks/use-global-shortcuts.js"; import React, { useState } from "react"; import { render, Box, Text } from "ink"; import { FusionProvider, useFusion } from "./fusion-context.js"; import { ScreenRouter, type ScreenId } from "./components/screen-router.js"; import { useGlobalShortcuts, HelpOverlay } from "./hooks/use-global-shortcuts.js"; import { ResponsiveHeader, ResponsiveTable, ResponsiveTaskRow, ResponsiveStatusBar } from "./components/responsive-layout.js"; import { fileURLToPath } from "url"; /** * Demo application showing FusionProvider + ScreenRouter usage. * Renders the screen router with placeholder screens for each tab. * This demo only runs when the file is executed directly (not when imported). */ function DemoApp() { const { projectPath } = useFusion(); const [activeScreen, setActiveScreen] = useState("board"); // Global keyboard shortcuts - handles Ctrl+C, q, ?/h, 1-5 const { helpVisible, toggleHelp } = useGlobalShortcuts({ onScreenChange: setActiveScreen, }); return ( {/* Help Overlay - shown when toggled, displayed at top */} {helpVisible && ( )} {/* Responsive Header */} {/* Screen Router */} {({ activeScreen }) => ( {activeScreen === "board" && ( Board Screen View and manage tasks on the kanban board {/* Demo: Responsive Task Table */} )} {activeScreen === "detail" && ( Detail Screen View and edit individual task details )} {activeScreen === "activity" && ( Activity Screen View recent activity and events )} {activeScreen === "agents" && ( Agents Screen Manage AI agents and their configurations )} {activeScreen === "settings" && ( Settings Screen Configure project settings and preferences )} )} {/* Responsive Status Bar */} ); } // Guard: only render if this file is being executed directly (not imported) const currentFile = fileURLToPath(import.meta.url); const isMainModule = process.argv[1] !== undefined && currentFile === process.argv[1]; const isDevRun = process.argv[1]?.includes("index.tsx"); if (isMainModule || isDevRun) { render( ); }