| 2957 | // ─── Minimal TUI (no model — plugin commands only) ────────────────────────── |
| 2958 | |
| 2959 | async function startMinimalTUI() { |
| 2960 | const readline = require('readline'); |
| 2961 | const rl = readline.createInterface({ |
| 2962 | input: process.stdin, |
| 2963 | output: process.stdout, |
| 2964 | prompt: chalk.cyan('smallcode> '), |
| 2965 | }); |
| 2966 | |
| 2967 | const createCommandHandler = require('./commands'); |
| 2968 | const handleCmd = createCommandHandler(config, [], 0, null, null, 0, null, escalationEngine, null); |
| 2969 | |
| 2970 | rl.prompt(); |
| 2971 | |
| 2972 | rl.on('line', async (line) => { |
| 2973 | const input = line.trim(); |
| 2974 | if (!input) { rl.prompt(); return; } |
| 2975 | |
| 2976 | if (input === '/exit' || input === '/quit') { |
| 2977 | console.log(chalk.gray('\n Goodbye.\n')); |
| 2978 | rl.close(); |
| 2979 | process.exit(0); |
| 2980 | } |
| 2981 | |
| 2982 | if (input.startsWith('/')) { |
| 2983 | await handleCmd(input, rl); |
| 2984 | return; |
| 2985 | } |
| 2986 | |
| 2987 | console.log(chalk.gray(' No model configured. Type /provider to set up, or /exit to quit.')); |
| 2988 | rl.prompt(); |
| 2989 | }); |
| 2990 | |
| 2991 | rl.on('close', () => process.exit(0)); |
| 2992 | } |
| 2993 | |
| 2994 | // ─── Main ──────────────────────────────────────────────────────────────────── |
| 2995 | |