UNPKG

termcode

Version:

Superior terminal AI coding agent with enterprise-grade security, intelligent error recovery, performance monitoring, and plugin system - Advanced Claude Code alternative

33 lines (32 loc) 2 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import React, { useState } from 'react'; import { Box, Text } from 'ink'; import TextInput from 'ink-text-input'; export const PromptInput = ({ height, active, mode, onSubmit, }) => { const [input, setInput] = useState(''); const borderColor = active ? 'blue' : 'gray'; const handleSubmit = (value) => { if (value.trim()) { onSubmit(value.trim()); setInput(''); } }; // Example prompts based on mode const easyModePrompts = [ 'Add a new feature', 'Fix the bug in login', 'Refactor the API code', 'Add unit tests', 'Update documentation', ]; const proModePrompts = [ 'Implement OAuth2 authentication with JWT tokens', 'Add Redis caching layer with fallback to database', 'Create comprehensive test suite with 90% coverage', 'Set up CI/CD pipeline with automated deployments', 'Optimize database queries and add proper indexing', ]; const placeholderPrompts = mode === 'easy' ? easyModePrompts : proModePrompts; const randomPrompt = placeholderPrompts[Math.floor(Math.random() * placeholderPrompts.length)]; return (_jsxs(Box, { height: height, borderStyle: "single", borderColor: borderColor, flexDirection: "column", children: [_jsxs(Box, { paddingX: 1, borderStyle: "single", borderTop: false, borderLeft: false, borderRight: false, children: [_jsx(Text, { color: "cyan", bold: true, children: "Prompt" }), _jsxs(Text, { color: "gray", marginLeft: 1, children: ["(", mode, " mode)"] })] }), _jsxs(Box, { paddingX: 1, paddingY: 1, flexGrow: 1, alignItems: "center", children: [_jsx(Text, { color: "green", marginRight: 1, children: "\u25B6" }), active ? (_jsx(TextInput, { value: input, onChange: setInput, onSubmit: handleSubmit, placeholder: randomPrompt, focus: active })) : (_jsx(Text, { color: "gray", dimColor: true, children: input || randomPrompt }))] })] })); };