Skip to main content

start_command/
mod.rs

1//! start-command library
2//!
3//! Provides command execution with isolation, substitution, and failure handling.
4
5pub mod args_parser;
6pub mod args_parser_queries;
7pub mod detached_finalize;
8pub(crate) mod docker_cleanup;
9mod docker_network_lifecycle;
10pub mod docker_post_mortem;
11pub mod execution_attach;
12pub mod execution_control;
13pub mod execution_resume;
14pub mod execution_resume_all;
15pub mod execution_store;
16pub mod exit_reason;
17pub mod failure_handler;
18pub mod isolation;
19pub mod isolation_metadata;
20pub mod log_uploader;
21pub mod output_blocks;
22pub mod query_commands;
23pub mod sequence_parser;
24pub mod session_probe;
25pub mod signal_handler;
26pub mod status_footer;
27pub mod status_formatter;
28pub mod status_probe;
29pub mod substitution;
30pub mod usage;
31pub mod user_manager;
32
33mod lino_value_json;
34mod local_hostname;
35
36// Re-export commonly used items
37pub use args_parser::{
38    generate_session_name, generate_uuid, get_effective_mode, has_isolation, is_valid_uuid,
39    parse_args, validate_options, ParsedArgs, WrapperOptions, VALID_BACKENDS, VALID_OUTPUT_FORMATS,
40    VALID_SHELLS,
41};
42pub use detached_finalize::{
43    build_detached_finalize_snippet, finalize_detached_execution, reconcile_finalized_record,
44    run_internal_finalize, DetachedFinalizeFacts, FinalizeOutcome,
45    END_TIME_SOURCE_DOCKER_FINISHED_AT, END_TIME_SOURCE_LOG_FOOTER, END_TIME_SOURCE_OBSERVED_AT,
46    INTERNAL_FINALIZE_FLAG,
47};
48pub use docker_post_mortem::{
49    build_docker_post_mortem_snippet, build_docker_removal_note_snippet,
50    build_docker_state_snippet, format_container_post_mortem, format_container_removal_note,
51    format_lifetime, normalize_docker_timestamp, ContainerPostMortem, DOCKER_STATE_INSPECT_FORMAT,
52    DOCKER_ZERO_TIME, POST_MORTEM_HEADER,
53};
54pub use execution_attach::{
55    attach_execution, attach_execution_with_runners, build_attach_plan,
56    format_attach_result_as_links_notation, AttachPlan, AttachResultFields, ExecutionAttachResult,
57    InteractiveRunner, SystemInteractiveRunner,
58};
59pub use execution_control::{
60    collect_descendant_pids, collect_descendant_pids_with_runner, collect_process_ids,
61    collect_process_ids_with_runner, control_execution, control_execution_with_runner,
62    format_control_result_as_links_notation, get_control_command, parse_screen_pid,
63    CommandRunOutput, CommandRunner, ControlAction, ControlCommand, ExecutionControlResult,
64    SystemCommandRunner,
65};
66pub use execution_resume::{
67    build_resume_plan, build_resumed_session_name, build_snapshot_image_name, resume_execution,
68    resume_execution_with, ExecutionResumeResult, ResumeHooks, ResumeMode, ResumePlan,
69    ResumeResultFields, SystemResumeHooks,
70};
71pub use execution_resume_all::{
72    format_resume_all, resume_all_executions, resume_all_executions_with, ExecutionResumeAllResult,
73    ResumeAllAction, ResumeAllEntry,
74};
75pub use execution_store::{
76    is_clink_installed, CleanupOptions, CleanupResult, ExecutionRecord, ExecutionRecordOptions,
77    ExecutionStats, ExecutionStatus, ExecutionStore, ExecutionStoreOptions,
78};
79pub use exit_reason::{
80    describe_exit_code, describe_exit_code_str, detect_exit_reason, resolve_exit_reason,
81    signal_name_for_exit_code, ExitCodeDescription,
82};
83pub use failure_handler::{handle_failure, Config as FailureConfig};
84pub use isolation::{
85    append_log_file, build_command_string, build_command_string_with, build_display_command,
86    build_shell_with_args_cmd_args, command_name, create_log_footer, create_log_header,
87    create_log_path, create_log_path_for_execution, docker_image_exists, docker_pull_image,
88    get_default_docker_image, get_timestamp, is_command_available, is_interactive_shell_command,
89    is_shell_invocation_with_args, quote_shell_arg, quote_shell_arg_with, run_as_isolated_user,
90    run_isolated, split_shell_words, split_shell_words_with, to_shell_words, write_log_file,
91    IsolationOptions, IsolationResult, LogHeaderParams, ShellQuotingStyle,
92};
93pub use isolation_metadata::{
94    build_isolation_options_map, docker_runtime_metadata, docker_runtime_status_lines,
95    docker_runtime_status_lines_for_options,
96};
97pub use log_uploader::upload_execution_log;
98#[allow(deprecated)]
99pub use output_blocks::{
100    // Timeline format API (formerly "status spine")
101    create_command_line,
102    create_empty_spine_line, // deprecated, use create_empty_timeline_line
103    create_empty_timeline_line,
104    create_finish_block,
105    create_spine_line, // deprecated, use create_timeline_line
106    create_start_block,
107    create_timeline_line,
108    create_timeline_separator,
109    create_virtual_command_block,
110    create_virtual_command_result,
111    escape_for_links_notation,
112    format_duration,
113    format_value_for_links_notation,
114    generate_isolation_lines,
115    get_result_marker,
116    parse_isolation_metadata,
117    FinishBlockOptions,
118    IsolationMetadata,
119    StartBlockOptions,
120    FAILURE_MARKER,
121    SPINE, // deprecated, use TIMELINE_MARKER
122    SUCCESS_MARKER,
123    TIMELINE_MARKER,
124};
125pub use query_commands::{dispatch_query_command, handle_cleanup, report_result, QueryOutcome};
126pub use session_probe::{probe_session, SessionProbe, SessionState};
127pub use signal_handler::{
128    clear_current_execution, get_signal_exit_code, set_current_execution, setup_signal_handlers,
129    was_signal_received,
130};
131pub use status_footer::{
132    parse_footer_from_tail, parse_footer_timestamp, read_footer_from_log, LogFooter,
133};
134pub use status_formatter::{
135    attach_current_time, enrich_detached_status, format_record, format_record_as_links_notation,
136    format_record_as_links_notation_with_current_time, format_record_as_text,
137    format_record_as_text_with_current_time, format_record_list,
138    format_record_list_as_links_notation, format_record_list_as_text,
139    format_record_with_current_time, list_executions, list_executions_filtered, query_status,
140    read_exit_code_from_log, StatusQueryResult,
141};
142pub use status_probe::is_detached_session_alive;
143pub use substitution::{process_command, ProcessOptions, SubstitutionResult};
144pub use usage::print_usage;
145pub use user_manager::{
146    create_isolated_user, delete_user, get_current_user, get_current_user_groups, has_sudo_access,
147    CreateIsolatedUserOptions, DeleteUserOptions, UserOperationResult,
148};