Yeesh (Yeesh v0.8.2)
View SourceA LiveView terminal component with sandboxed command execution.
Yeesh provides a browser-based CLI with fish/zsh-like features and Dune-powered sandboxed Elixir evaluation.
Quick Start
Add yeesh to your dependencies, then use the terminal component
in any LiveView:
<.live_component
module={Yeesh.Live.TerminalComponent}
id="terminal"
commands={[MyApp.Commands.Deploy, MyApp.Commands.Status]}
/>Configuration
The following application-level config options are supported:
:enable_mix_command- whentrue, registers the built-inmixcommand that allows running arbitrary Mix tasks from the terminal. Defaults tofalse. Enable it in yourconfig.exs:config :yeesh, enable_mix_command: true
Custom Commands
Implement the Yeesh.Command behaviour:
defmodule MyApp.Commands.Greet do
@behaviour Yeesh.Command
@impl true
def name, do: "greet"
@impl true
def description, do: "Greet a user"
@impl true
def usage, do: "greet <name>"
@impl true
def completions(_partial, _session), do: []
@impl true
def execute(args, session) do
name = Enum.join(args, " ")
{:ok, "Hello, #{name}!", session}
end
endExecution Model
Command execution is currently synchronous -- the LiveView process blocks until the command completes (with a configurable timeout, default 5s).
Async streaming execution is planned for Milestone 3.
OS Command Passthrough
OS command passthrough is planned for Milestone 2 and is not included
in the current release. All commands must be explicitly registered
via the Yeesh.Command behaviour.