Current section
Files
Jump to
Current section
Files
lib/mix/tasks/ex_claw.start.ex
defmodule Mix.Tasks.ExClaw.Start do
@moduledoc """
Boots the full ExClaw stack (config, gateway, channels).
mix ex_claw.start [--config PATH] [--port PORT]
Options:
--config Path to a config file to apply before starting
--port Port to listen on (default: 4000)
"""
use Mix.Task
@shortdoc "Boot the full ExClaw stack"
@impl true
def run(args) do
{opts, _, _} = OptionParser.parse(args, strict: [config: :string, port: :integer])
Mix.Task.run("app.start")
if config_path = opts[:config] do
case ExClaw.Config.apply_config(config_path) do
{:ok, _config} ->
Mix.shell().info("Config applied from #{config_path}")
{:error, reason} ->
Mix.raise("Failed to apply config #{config_path}: #{inspect(reason)}")
end
end
# Ensure workspace files exist and scan skills
ExClaw.Workspace.ensure_files!()
ExClaw.Skill.Registry.scan_workspace()
port = Keyword.get(opts, :port, 4000)
{:ok, _pid} = ExClaw.Gateway.start_link(port: port)
Mix.shell().info("ExClaw started on port #{port}")
Mix.shell().info(" Health: http://localhost:#{port}/health")
Mix.shell().info(" Status: http://localhost:#{port}/status")
Mix.shell().info(" Chat: POST http://localhost:#{port}/chat")
Process.sleep(:infinity)
end
end