osp_cli/repl/mod.rs
1//! The REPL module exists to own interactive shell behavior that the ordinary
2//! CLI host should not know about.
3//!
4//! The layering here is intentional:
5//!
6//! - `engine` owns the line editor boundary, prompt rendering, history
7//! picker/completion adapters, and debug surfaces.
8//! - `dispatch` owns command execution and shell-scope behavior once a line
9//! has been accepted.
10//! - `completion` shapes the live command catalog into REPL-aware completion
11//! trees.
12//! - `presentation` owns prompt appearance and intro/help material that is
13//! specific to interactive use.
14//!
15//! When debugging the REPL, first decide whether the issue is editor/runtime
16//! state, dispatch semantics, or rendering. That is usually enough to choose
17//! the right submodule.
18//!
19//! Contract:
20//!
21//! - this module may depend on editor/runtime adapters, completion, UI, and
22//! dispatch code
23//! - it should not become the owner of generic command execution rules, config
24//! resolution, or non-interactive CLI parsing
25//!
26//! Public API shape:
27//!
28//! - debug snapshots and other semantic payloads stay direct and cheap to read
29//! - host-style REPL configuration flows through concrete builders and
30//! factories such as [`crate::repl::ReplRunConfig::builder`],
31//! [`crate::repl::ReplAppearance::builder`], and
32//! [`crate::repl::HistoryConfig::builder`]
33//! - guided REPL configuration follows the crate-wide naming rule:
34//! `new(...)` for exact constructors, `builder(...)` for staged
35//! configuration, `with_*` setters, and `build()` as the terminal step
36
37pub(crate) mod completion;
38pub(crate) mod dispatch;
39mod engine;
40pub(crate) mod help;
41mod highlight;
42pub(crate) mod history;
43mod history_store;
44mod host;
45pub(crate) mod input;
46pub(crate) mod lifecycle;
47mod menu;
48mod menu_core;
49pub(crate) mod presentation;
50pub(crate) mod surface;
51
52#[cfg(test)]
53pub(crate) use dispatch::apply_repl_shell_prefix;
54#[cfg(test)]
55pub(crate) use engine::ReplCompleter;
56pub use engine::{
57 CompletionDebug, CompletionDebugFrame, CompletionDebugMatch, CompletionDebugOptions, DebugStep,
58 HighlightDebugSpan, HistoryConfig, HistoryConfigBuilder, HistoryEntry, HistoryShellContext,
59 LineProjection, LineProjector, PromptRightRenderer, ReplAppearance, ReplAppearanceBuilder,
60 ReplInputMode, ReplLineResult, ReplPrompt, ReplReloadKind, ReplRunConfig, ReplRunConfigBuilder,
61 ReplRunResult, SharedHistory, color_from_style_spec, debug_completion, debug_completion_steps,
62 debug_highlight, debug_history_menu, debug_history_menu_steps, default_pipe_verbs, run_repl,
63};
64pub(crate) use engine::{
65 CompletionTraceEvent, CompletionTraceMenuState, expand_history, trace_completion,
66 trace_completion_enabled,
67};
68pub(crate) use host::{
69 ReplViewContext, repl_command_spec, run_plugin_repl, run_repl_debug_command_for,
70};
71#[cfg(test)]
72pub(crate) use input::{ReplParsedLine, is_repl_shellable_command};
73#[cfg(test)]
74pub(crate) use presentation::{
75 render_prompt_template, render_repl_prompt_right_for_test, theme_display_name,
76};