# `MingaEditor.Agent.SlashCommand`
[🔗](https://github.com/jsmestad/minga/blob/main/lib/minga_editor/agent/slash_command.ex#L1)

Slash command registry and dispatcher for the agent chat input.

When the user types `/` at the start of input and submits, the text is
routed here instead of being sent to the LLM. Each command is a simple
`{description, handler_fn}` where the handler receives the editor state
and any arguments after the command name.

# `command`

```elixir
@type command() :: MingaEditor.Agent.SlashCommand.Command.t()
```

A registered slash command.

# `completion_candidate`

```elixir
@type completion_candidate() :: %{
  label: String.t(),
  insert: String.t(),
  description: String.t()
}
```

A completion candidate for agent slash input.

# `state`

```elixir
@type state() :: map()
```

Editor state (same as EditorState.t()).

# `commands`

```elixir
@spec commands() :: [command()]
```

Returns the list of all registered slash commands (static and dynamic).

# `completion_candidates`

```elixir
@spec completion_candidates(state(), String.t()) :: [completion_candidate()]
```

Returns completion candidates for the current slash input, without the leading slash.

# `completions`

```elixir
@spec completions(String.t()) :: [command()]
```

Returns commands whose names start with the given prefix.

# `detect_project_root`

# `dynamic_commands`

```elixir
@spec dynamic_commands() :: [MingaEditor.Agent.SlashCommand.Command.t()]
```

Returns slash commands contributed by loaded extensions.

# `execute`

```elixir
@spec execute(state(), String.t()) :: {:ok, state()} | {:error, String.t()}
```

Parses and executes a slash command from raw input text.

Returns `{:ok, state}` if the command was recognized and executed,
or `{:error, message}` if the command is unknown.

# `sensitive_command?`

```elixir
@spec sensitive_command?(String.t()) :: boolean()
```

Returns true when a slash command may contain secrets and must not enter prompt history.

# `slash_command?`

```elixir
@spec slash_command?(String.t()) :: boolean()
```

Returns true if the given text is a slash command (starts with /).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
