โจ๏ธ Command line shell (executable) โ
The command-line shell executable provides text command dispatch for both interactive terminal sessions and one-shot command invocation.
Role โ
- Parses user input into built-in command handlers or executable launch requests.
- Maintains shell process state (
current_directory,user,host, running flag).
Startup and lifecycle โ
- Initializes
Shellstate with current task and root directory. - Resolves
Userfrom task env; if absent, runs interactive authentication flow. - Loads
PathsandHostenvironment variables. - Runs interactive loop (prompt + read + parse) when no args; otherwise executes one command from args.
Runtime integration points โ
taskmodule for environment variable reads/writes (User,Paths,Current_directory,Host).authenticationcrate for login fallback flow.virtual_file_systemfor path resolution and command file discovery.xila::executable::executefor non-built-in command execution.
Data and control flow / VFS touchpoints โ
- Built-in command path: command token -> command module handler -> direct side effects.
- External executable path:
- resolve command name using configured
Pathsdirectories, - set
Current_directoryenv, - call
execute(...), - join spawned task.
- resolve command name using configured
- VFS touchpoints include directory traversal during command resolution and file operations in command modules.
Concurrency and event-loop model โ
- Primary model is single interactive loop over standard input.
- External commands run as separate executable tasks and are synchronously joined by shell.
Failure semantics โ
- Command-level errors are written to
standard_errorand loop continues. - Argument option misuse maps through
getargsto typed shell errors. - Missing environment variables (
Paths,Host) are fatal for startup path.
Contract vs implementation โ
- Contract: text shell that supports built-ins and executable dispatch from search paths.
- Current implementation: explicit match-based built-in table (
exit,cd,ls,mkdir,dns_resolve,ping,ip, etc.) with fallback resolver-based execution.
Operational limitations โ
- Tokenization currently relies on simple space splitting in interactive path (no full quoting/escaping grammar).
- Prompt/loop behavior is line-oriented and depends on standard input device semantics.