()
| 44 | }; |
| 45 | |
| 46 | const handleFilenameSubmit = () => { |
| 47 | const finalFilename = filename.endsWith('.txt') ? filename : filename.replace(/\.[^.]+$/, '') + '.txt'; |
| 48 | const filepath = join(getCwd(), finalFilename); |
| 49 | |
| 50 | try { |
| 51 | writeFileSync_DEPRECATED(filepath, content, { |
| 52 | encoding: 'utf-8', |
| 53 | flush: true, |
| 54 | }); |
| 55 | onDone({ |
| 56 | success: true, |
| 57 | message: `Conversation exported to: ${filepath}`, |
| 58 | }); |
| 59 | } catch (error) { |
| 60 | onDone({ |
| 61 | success: false, |
| 62 | message: `Failed to export conversation: ${error instanceof Error ? error.message : 'Unknown error'}`, |
| 63 | }); |
| 64 | } |
| 65 | }; |
| 66 | |
| 67 | // Dialog calls onCancel when Escape is pressed. If we are in the filename |
| 68 | // input sub-screen, go back to the option list instead of closing entirely. |
nothing calls this directly
no test coverage detected