Skip to main content

start_command/
usage.rs

1/// Print usage information
2pub fn print_usage() {
3    println!(
4        r#"Usage: start [options] [--] <command> [args...]
5       start <command> [args...]
6       start --status <uuid> [--output-format <format>]
7       start --list [--running] [--output-format <format>]
8       start --upload-log <uuid-or-session-name>
9       start --stop <uuid-or-session-name>
10       start --terminate <uuid-or-session-name>
11       start --attach <uuid-or-session-name> [--read-only]
12       start --resume <uuid-or-session-name> [-- <command>]
13       start --resume-all [--output-format <format>]
14
15Options:
16  --isolated, --isolation, -i <env>  Run in isolated environment (screen, tmux, docker, ssh)
17  --attached, -a        Run in attached mode (foreground)
18  --detached, -d        Run in detached mode (background)
19  --session, -s <name>  Session name for isolation
20  --session-id <uuid>   Session UUID for tracking (auto-generated if not provided)
21  --session-name <uuid> Alias for --session-id
22  --image <image>       Docker image (optional, defaults to OS-matched image)
23  --volume, -v <spec>   Docker bind mount/volume host:container[:mode] (repeatable, docker only)
24  --mount <spec>        Docker --mount spec (repeatable, docker only)
25  --env, -e <KEY=VALUE> Environment variable for docker container (repeatable, docker only)
26  --privileged          Run docker container in privileged mode (docker only)
27  --network <name>      Connect to a named network (repeatable, docker only)
28  --network-alias <alias> Add alias to the first network (repeatable, docker only)
29  --on-kill-resume <N>  Resume a killed (exit 137 / OOM) detached docker session up to N times
30  --recovery-command <cmd>  Command to run in the same container on such a resume
31  --on-kill-resume-delay <min[-max]>  Wait a random number of seconds before each such resume (default 0)
32  --endpoint <endpoint> SSH endpoint (required for ssh isolation, e.g., user@host)
33  --isolated-user, -u [name]  Create isolated user with same permissions
34  --keep-user           Keep isolated user after command completes
35  --keep-alive, -k      Keep isolation environment alive after command exits
36  --auto-remove-docker-container  Always remove docker container after exit (compatibility alias)
37  --always-cleanup-container  Always remove docker container after exit
38  --keep-container     Keep docker container filesystem after exit
39  --keep-container-on-fail  Remove successful docker containers, keep failed or OOM-killed ones
40  --shell <shell>       Shell to use in isolation environments: auto, bash, zsh, sh (default: auto)
41  --use-command-stream  Use command-stream library for execution (experimental)
42  --status <id>         Show status of execution by UUID or session name (--output-format: links-notation|json|text)
43  --list                List all tracked executions (--output-format: links-notation|json|text)
44  --running             With --list, only report executions that are still running
45  --upload-log <id>     Upload the stored log for an execution UUID or session name
46  --stop <id>           Ask a detached isolated execution to stop gracefully
47  --terminate <id>      Terminate a detached isolated execution immediately
48  --attach <id>         Attach to a running detached isolated execution
49  --read-only           With --attach, follow output without sending input
50  --resume <id>         Restart a stopped detached execution in the same environment
51                        (append -- <command> to run a different command there)
52  --resume-all          Re-attach or reconcile every execution still marked running
53  --cleanup             Clean up stale "executing" records (crashed/killed processes)
54  --cleanup-dry-run     Show stale records that would be cleaned up (without cleaning)
55  --version, -v         Show version information
56
57Examples:
58  start echo "Hello World"
59  start bun test
60  start --isolated tmux -- bun start
61  start -i screen -d bun start
62  start --isolated docker -- echo 'hi'  # uses OS-matched default image
63  start --isolated docker --image oven/bun:latest -- bun install
64  start -i docker -v ~/.config/gh:/root/.config/gh -e TOKEN=abc -- gh repo list
65  start -i docker --image konard/hive-mind-dind:latest --privileged -- solve ...
66  start --isolated ssh --endpoint user@remote.server -- ls -la
67  start --isolated-user -- npm test
68  start -u myuser -- npm start
69  start -i screen --isolated-user -- npm test
70  start --status a1b2c3d4-e5f6-7890-abcd-ef1234567890
71  start --status a1b2c3d4 --output-format json
72  start --list
73  start --list --output-format json
74  start --list --running
75  start --upload-log my-screen-session
76  start --stop my-screen-session
77  start --terminate my-screen-session
78  start --attach my-docker-session
79  start --attach my-docker-session --read-only
80  start --resume my-docker-session
81  start --resume my-docker-session -- bash
82  start --resume-all
83  start -i docker -d --on-kill-resume 3 --recovery-command 'solve --resume' -- solve
84  start -i docker -d --on-kill-resume 3 --on-kill-resume-delay 30-90 -- cargo test
85  start --cleanup-dry-run
86  start --cleanup
87
88Features:
89  - Logs all output to temporary directory
90  - Displays timestamps and exit codes
91  - Auto-reports failures for NPM packages (when gh is available)
92  - Natural language command aliases (via substitutions.lino)
93  - Process isolation via screen, tmux, or docker"#
94    );
95}