1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! 1.2.10+ — standalone TUI prompts editor.
//!
//! Launched as `inkhaven prompts-editor -p <dir>`.
//! Four-pane workbench:
//!
//! * **Left** — prompts list.
//! * **Centre** — prompt editor (same chord set as
//! the main inkhaven editor).
//! * **Right** — AI response (display-only).
//! * **Bottom** — AI prompt input (single-line).
//!
//! Send semantics: typing in the AI prompt + pressing
//! Enter renders the editor's body as a template
//! (substituting `{{selection}}` with the AI prompt
//! input + `{{context}}` with empty), sends the
//! result as the user message to the configured LLM
//! with no system prompt, and streams the response
//! into the AI pane.
//!
//! **Phase 1**: read-only walk-through. CLI plumbing,
//! the four-pane shell, list navigation,
//! show-on-focus editor display, help pane. No
//! mutation, no save, no AI send — those land in
//! Phases 2 and 3.
//!
//! See `Documentation/PROPOSALS/PROMPTS_EDITOR_TUI.md`
//! for the full design.
use Path;
use Result;
/// Entry point — called from the `inkhaven
/// prompts-editor` subcommand dispatcher. Initialises
/// the terminal, loads `prompts.hjson` (or the
/// embedded defaults when missing), runs the event
/// loop, restores the terminal on exit.